From 0b809cec2f69778fd8f3533c57f2aa2f71e946b9 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Thu, 13 Nov 2025 16:47:38 +0800 Subject: [PATCH] a lot of stuffs need to be taken care of --- .../src/ApiCompatBaseline.txt | 7 - .../AccountsGetAllAsyncCollectionResultOfT.cs | 85 + .../AccountsGetAllCollectionResultOfT.cs | 84 + ...tBySubscriptionAsyncCollectionResultOfT.cs | 78 + ...ntsGetBySubscriptionCollectionResultOfT.cs | 77 + .../ActiveDirectoryConfigCollection.cs | 548 +++ ...ActiveDirectoryConfigData.Serialization.cs | 260 + .../Generated/ActiveDirectoryConfigData.cs | 56 + ...veDirectoryConfigResource.Serialization.cs | 39 + .../ActiveDirectoryConfigResource.cs | 682 +++ ...ByResourceGroupAsyncCollectionResultOfT.cs | 85 + ...gsGetByResourceGroupCollectionResultOfT.cs | 84 + ...tBySubscriptionAsyncCollectionResultOfT.cs | 78 + ...igsGetBySubscriptionCollectionResultOfT.cs | 77 + .../src/Generated/ArmNetAppModelFactory.cs | 4185 +++++++++-------- .../src/Generated/BackupCollection.cs | 567 +++ .../src/Generated/BackupData.Serialization.cs | 195 + .../src/Generated/BackupData.cs | 206 + ...pPoliciesGetAllAsyncCollectionResultOfT.cs | 89 + ...BackupPoliciesGetAllCollectionResultOfT.cs | 88 + .../src/Generated/BackupPolicyCollection.cs | 547 +++ .../BackupPolicyData.Serialization.cs | 237 + .../src/Generated/BackupPolicyData.cs | 160 + .../BackupPolicyResource.Serialization.cs | 39 + .../src/Generated/BackupPolicyResource.cs | 683 +++ .../Generated/BackupResource.Serialization.cs | 39 + .../src/Generated/BackupResource.cs | 512 ++ .../src/Generated/BackupVaultCollection.cs | 547 +++ .../BackupVaultData.Serialization.cs | 232 + .../src/Generated/BackupVaultData.cs | 55 + .../BackupVaultResource.Serialization.cs | 39 + .../src/Generated/BackupVaultResource.cs | 716 +++ ...ByNetAppAccountAsyncCollectionResultOfT.cs | 89 + ...tsGetByNetAppAccountCollectionResultOfT.cs | 88 + ...ckupsGetByVaultAsyncCollectionResultOfT.cs | 96 + .../BackupsGetByVaultCollectionResultOfT.cs | 95 + .../src/Generated/BucketCollection.cs | 561 +++ .../src/Generated/BucketData.Serialization.cs | 197 + .../src/Generated/BucketData.cs | 135 + .../Generated/BucketResource.Serialization.cs | 39 + .../src/Generated/BucketResource.cs | 513 ++ .../BucketsGetAllAsyncCollectionResultOfT.cs | 97 + .../BucketsGetAllCollectionResultOfT.cs | 96 + .../src/Generated/CacheCollection.cs | 559 +++ .../src/Generated/CacheData.Serialization.cs | 275 ++ .../src/Generated/CacheData.cs | 62 + .../Generated/CacheResource.Serialization.cs | 39 + .../src/Generated/CacheResource.cs | 874 ++++ ...ByCapacityPoolsAsyncCollectionResultOfT.cs | 93 + ...esGetByCapacityPoolsCollectionResultOfT.cs | 92 + .../src/Generated/CapacityPoolCollection.cs | 404 +- .../CapacityPoolData.Serialization.cs | 335 +- .../src/Generated/CapacityPoolData.cs | 231 +- .../CapacityPoolResource.Serialization.cs | 18 +- .../src/Generated/CapacityPoolResource.cs | 713 ++- .../src/Generated/ElasticAccountCollection.cs | 548 +++ .../ElasticAccountData.Serialization.cs | 260 + .../src/Generated/ElasticAccountData.cs | 56 + .../ElasticAccountResource.Serialization.cs | 39 + .../src/Generated/ElasticAccountResource.cs | 814 ++++ ...ByResourceGroupAsyncCollectionResultOfT.cs | 85 + ...tsGetByResourceGroupCollectionResultOfT.cs | 84 + ...tBySubscriptionAsyncCollectionResultOfT.cs | 78 + ...ntsGetBySubscriptionCollectionResultOfT.cs | 77 + .../src/Generated/ElasticBackupCollection.cs | 559 +++ .../ElasticBackupData.Serialization.cs | 197 + .../src/Generated/ElasticBackupData.cs | 43 + ...yElasticAccountAsyncCollectionResultOfT.cs | 89 + ...sGetByElasticAccountCollectionResultOfT.cs | 88 + .../ElasticBackupPolicyCollection.cs | 547 +++ .../ElasticBackupPolicyData.Serialization.cs | 244 + .../src/Generated/ElasticBackupPolicyData.cs | 51 + ...asticBackupPolicyResource.Serialization.cs | 39 + .../Generated/ElasticBackupPolicyResource.cs | 682 +++ .../ElasticBackupResource.Serialization.cs | 39 + .../src/Generated/ElasticBackupResource.cs | 407 ++ .../Generated/ElasticBackupVaultCollection.cs | 547 +++ .../ElasticBackupVaultData.Serialization.cs | 244 + .../src/Generated/ElasticBackupVaultData.cs | 60 + ...lasticBackupVaultResource.Serialization.cs | 39 + .../Generated/ElasticBackupVaultResource.cs | 715 +++ ...yElasticAccountAsyncCollectionResultOfT.cs | 89 + ...sGetByElasticAccountCollectionResultOfT.cs | 88 + ...ckupsGetByVaultAsyncCollectionResultOfT.cs | 93 + ...ticBackupsGetByVaultCollectionResultOfT.cs | 92 + .../ElasticCapacityPoolCollection.cs | 547 +++ .../ElasticCapacityPoolData.Serialization.cs | 282 ++ .../src/Generated/ElasticCapacityPoolData.cs | 57 + ...asticCapacityPoolResource.Serialization.cs | 39 + .../Generated/ElasticCapacityPoolResource.cs | 938 ++++ ...ByNetAppAccountAsyncCollectionResultOfT.cs | 89 + ...lsGetByNetAppAccountCollectionResultOfT.cs | 88 + .../Generated/ElasticSnapshotCollection.cs | 561 +++ .../ElasticSnapshotData.Serialization.cs | 197 + .../src/Generated/ElasticSnapshotData.cs | 52 + ...yElasticAccountAsyncCollectionResultOfT.cs | 89 + ...sGetByElasticAccountCollectionResultOfT.cs | 88 + ...iciesGetVolumesAsyncCollectionResultOfT.cs | 93 + ...otPoliciesGetVolumesCollectionResultOfT.cs | 92 + .../ElasticSnapshotPolicyCollection.cs | 547 +++ ...ElasticSnapshotPolicyData.Serialization.cs | 244 + .../Generated/ElasticSnapshotPolicyData.cs | 51 + ...ticSnapshotPolicyResource.Serialization.cs | 39 + .../ElasticSnapshotPolicyResource.cs | 718 +++ .../ElasticSnapshotResource.Serialization.cs | 39 + .../src/Generated/ElasticSnapshotResource.cs | 408 ++ ...ByElasticVolumeAsyncCollectionResultOfT.cs | 97 + ...tsGetByElasticVolumeCollectionResultOfT.cs | 96 + .../src/Generated/ElasticVolumeCollection.cs | 559 +++ .../ElasticVolumeData.Serialization.cs | 282 ++ .../src/Generated/ElasticVolumeData.cs | 57 + .../ElasticVolumeResource.Serialization.cs | 39 + .../src/Generated/ElasticVolumeResource.cs | 835 ++++ ...etByElasticPoolAsyncCollectionResultOfT.cs | 93 + ...umesGetByElasticPoolCollectionResultOfT.cs | 92 + .../Extensions/MockableNetAppArmClient.cs | 283 +- .../MockableNetAppResourceGroupResource.cs | 250 +- .../MockableNetAppSubscriptionResource.cs | 1031 ++-- .../MockableNetAppTenantResource.cs | 65 + .../Generated/Extensions/NetAppExtensions.cs | 1505 +++--- .../src/Generated/Internal/Argument.cs | 75 +- .../Internal/AsyncPageableWrapper.cs | 48 + .../Internal/ChangeTrackingDictionary.cs | 24 +- .../Generated/Internal/ChangeTrackingList.cs | 17 +- .../Internal/ClientPipelineExtensions.cs | 72 + .../Internal/CodeGenMemberAttribute.cs | 20 + .../Internal/CodeGenSerializationAttribute.cs | 48 + .../Internal/CodeGenSuppressAttribute.cs | 29 + .../Internal/CodeGenTypeAttribute.cs | 24 + .../src/Generated/Internal/ErrorResult.cs | 32 + .../Internal/ModelSerializationExtensions.cs | 173 +- .../src/Generated/Internal/Optional.cs | 12 +- .../src/Generated/Internal/PageableWrapper.cs | 47 + .../RawRequestUriBuilderExtensions.cs | 23 + .../Internal/RequestContextExtensions.cs | 26 + .../Generated/Internal/SerializationFormat.cs | 49 + .../src/Generated/Internal/TypeFormatters.cs | 181 + .../Internal/Utf8JsonRequestContent.cs | 8 +- .../ActiveDirectoryConfigOperationSource.cs | 49 + .../BackupOperationSource.cs | 49 + .../BackupPolicyOperationSource.cs | 49 + .../BackupVaultOperationSource.cs | 49 + .../BucketOperationSource.cs | 49 + .../CacheOperationSource.cs | 49 + .../CapacityPoolOperationSource.cs | 23 +- ...usterPeerCommandResponseOperationSource.cs | 45 + ...ClusterPeerCommandResultOperationSource.cs | 30 - .../ElasticAccountOperationSource.cs | 49 + .../ElasticBackupOperationSource.cs | 49 + .../ElasticBackupPolicyOperationSource.cs | 49 + .../ElasticBackupVaultOperationSource.cs | 49 + .../ElasticCapacityPoolOperationSource.cs | 49 + .../ElasticSnapshotOperationSource.cs | 49 + .../ElasticSnapshotPolicyOperationSource.cs | 49 + .../ElasticVolumeOperationSource.cs | 49 + ...dListForLdapUserResponseOperationSource.cs | 45 + ...pIdListForLdapUserResultOperationSource.cs | 30 - ...etKeyVaultStatusResponseOperationSource.cs | 45 + .../ListQuotaReportResponseOperationSource.cs | 45 + .../NetAppAccountOperationSource.cs | 23 +- .../NetAppArmOperation.cs | 70 +- .../NetAppArmOperationOfT.cs | 79 +- .../NetAppBackupPolicyOperationSource.cs | 36 - .../NetAppBackupVaultBackupOperationSource.cs | 36 - .../NetAppBackupVaultOperationSource.cs | 36 - .../NetAppBucketOperationSource.cs | 36 - ...tAppKeyVaultStatusResultOperationSource.cs | 30 - .../NetAppSubvolumeInfoOperationSource.cs | 36 - .../NetAppSubvolumeMetadataOperationSource.cs | 30 - .../NetAppVolumeGroupOperationSource.cs | 36 - .../NetAppVolumeOperationSource.cs | 36 - ...umeQuotaReportListResultOperationSource.cs | 30 - .../NetAppVolumeQuotaRuleOperationSource.cs | 36 - .../NetAppVolumeSnapshotOperationSource.cs | 36 - .../NetworkSiblingSetOperationSource.cs | 30 - .../SnapshotOperationSource.cs | 49 + .../SnapshotPolicyOperationSource.cs | 23 +- .../SubvolumeInfoOperationSource.cs | 49 + .../SubvolumeModelOperationSource.cs | 45 + .../SvmPeerCommandResponseOperationSource.cs | 45 + .../SvmPeerCommandResultOperationSource.cs | 30 - .../VolumeGroupDetailsOperationSource.cs | 49 + .../VolumeOperationSource.cs | 49 + .../VolumeQuotaRuleOperationSource.cs | 49 + ...tGrowCapacityPoolForShortTermCloneSplit.cs | 38 +- .../Models/AccountEncryption.Serialization.cs | 175 + .../src/Generated/Models/AccountEncryption.cs | 46 + .../Models/AccountProperties.Serialization.cs | 251 + .../src/Generated/Models/AccountProperties.cs | 68 + ...on.cs => ActiveDirectory.Serialization.cs} | 290 +- ...tActiveDirectory.cs => ActiveDirectory.cs} | 97 +- ...DirectoryConfigListResult.Serialization.cs | 177 + .../Models/ActiveDirectoryConfigListResult.cs | 45 + ...ctiveDirectoryConfigPatch.Serialization.cs | 213 + .../Models/ActiveDirectoryConfigPatch.cs | 49 + ...DirectoryConfigProperties.Serialization.cs | 387 ++ .../Models/ActiveDirectoryConfigProperties.cs | 105 + ...oryConfigUpdateProperties.Serialization.cs | 360 ++ .../ActiveDirectoryConfigUpdateProperties.cs | 87 + .../Generated/Models/ActiveDirectoryStatus.cs | 86 + .../Models/ActualRansomwareProtectionState.cs | 81 + .../Models/AuthorizeRequest.Serialization.cs | 154 + .../src/Generated/Models/AuthorizeRequest.cs | 36 + .../AvailabilityZoneMapping.Serialization.cs | 80 +- .../Models/AvailabilityZoneMapping.cs | 46 +- .../src/Generated/Models/AvsDataStore.cs | 71 + .../AzureResourceManagerNetAppContext.cs | 299 +- .../Models/BackupPatch.Serialization.cs | 158 + .../src/Generated/Models/BackupPatch.cs | 53 + .../BackupPatchProperties.Serialization.cs | 141 + .../Generated/Models/BackupPatchProperties.cs | 36 + .../BackupPoliciesList.Serialization.cs | 122 +- .../Generated/Models/BackupPoliciesList.cs | 57 +- .../Models/BackupPolicyPatch.Serialization.cs | 247 + .../src/Generated/Models/BackupPolicyPatch.cs | 171 + .../BackupPolicyProperties.Serialization.cs | 261 + .../Models/BackupPolicyProperties.cs | 73 + .../Models/BackupProperties.Serialization.cs | 336 ++ .../BackupProperties.cs} | 87 +- .../BackupRestoreFiles.Serialization.cs | 197 + .../Generated/Models/BackupRestoreFiles.cs | 56 + .../Models/BackupVaultPatch.Serialization.cs | 181 + .../src/Generated/Models/BackupVaultPatch.cs | 38 + .../BackupVaultProperties.Serialization.cs | 141 + .../Generated/Models/BackupVaultProperties.cs | 36 + .../Models/BackupVaultsList.Serialization.cs | 121 +- .../src/Generated/Models/BackupVaultsList.cs | 59 +- .../Models/BackupsList.Serialization.cs | 121 +- .../src/Generated/Models/BackupsList.cs | 59 +- .../BackupsMigrationContent.Serialization.cs | 126 - .../Models/BackupsMigrationContent.cs | 75 - .../BackupsMigrationRequest.Serialization.cs | 156 + .../Models/BackupsMigrationRequest.cs | 43 + .../BreakFileLocksRequest.Serialization.cs | 169 + .../Generated/Models/BreakFileLocksRequest.cs | 41 + .../BreakReplicationRequest.Serialization.cs | 158 + .../Models/BreakReplicationRequest.cs | 36 + .../src/Generated/Models/BreakthroughMode.cs | 75 + .../BucketCredentialsExpiry.Serialization.cs | 158 + .../Models/BucketCredentialsExpiry.cs | 36 + ...BucketGenerateCredentials.Serialization.cs | 176 + .../Models/BucketGenerateCredentials.cs | 46 + .../Models/BucketList.Serialization.cs | 177 + .../src/Generated/Models/BucketList.cs | 45 + .../Models/BucketPatch.Serialization.cs | 188 + .../src/Generated/Models/BucketPatch.cs | 119 + .../Models/BucketPatchPermissions.cs | 71 + .../BucketPatchProperties.Serialization.cs | 207 + .../Generated/Models/BucketPatchProperties.cs | 56 + .../src/Generated/Models/BucketPermissions.cs | 71 + .../Models/BucketProperties.Serialization.cs | 223 + .../src/Generated/Models/BucketProperties.cs | 73 + ...cketServerPatchProperties.Serialization.cs | 152 + .../Models/BucketServerPatchProperties.cs | 41 + .../BucketServerProperties.Serialization.cs | 195 + .../Models/BucketServerProperties.cs | 56 + .../Generated/Models/CacheLifeCycleState.cs | 86 + .../Models/CacheList.Serialization.cs | 177 + .../src/Generated/Models/CacheList.cs | 45 + ...acheMountTargetProperties.Serialization.cs | 168 + .../Models/CacheMountTargetProperties.cs | 47 + .../Models/CachePatch.Serialization.cs | 196 + .../src/Generated/Models/CachePatch.cs | 43 + .../Models/CacheProperties.Serialization.cs | 509 ++ .../src/Generated/Models/CacheProperties.cs | 174 + .../Models/CacheProvisioningState.cs | 91 + .../CacheUpdateProperties.Serialization.cs | 296 ++ .../Generated/Models/CacheUpdateProperties.cs | 80 + .../Models/CapacityPoolEncryptionType.cs | 38 +- .../Models/CapacityPoolList.Serialization.cs | 117 +- .../src/Generated/Models/CapacityPoolList.cs | 59 +- .../Models/CapacityPoolPatch.Serialization.cs | 258 +- .../src/Generated/Models/CapacityPoolPatch.cs | 160 +- .../Generated/Models/CapacityPoolQosType.cs | 51 - .../Models/ChangeKeyVault.Serialization.cs | 197 + ...AppChangeKeyVault.cs => ChangeKeyVault.cs} | 58 +- .../Models/ChangeZoneRequest.Serialization.cs | 156 + .../src/Generated/Models/ChangeZoneRequest.cs | 42 + ...CheckAvailabilityResponse.Serialization.cs | 180 + ...Result.cs => CheckAvailabilityResponse.cs} | 51 +- .../CheckElasticResourceAvailabilityReason.cs | 71 + ...esourceAvailabilityResult.Serialization.cs | 180 + .../CheckElasticResourceAvailabilityResult.cs | 46 + .../CheckElasticResourceAvailabilityStatus.cs | 71 + ...lePathAvailabilityRequest.Serialization.cs | 156 + ...lasticVolumeFilePathAvailabilityRequest.cs | 42 + .../Models/CheckNameResourceTypes.cs | 87 + .../Models/CheckQuotaNameResourceTypes.cs | 87 + .../src/Generated/Models/ChownMode.cs | 69 + .../Generated/Models/CifsChangeNotifyState.cs | 71 + .../Models/CifsUser.Serialization.cs | 74 +- .../src/Generated/Models/CifsUser.cs | 39 +- ...lusterPeerCommandResponse.Serialization.cs | 150 + .../Models/ClusterPeerCommandResponse.cs | 36 + .../ClusterPeerCommandResult.Serialization.cs | 129 - .../Models/ClusterPeerCommandResult.cs | 65 - .../Models/CoolAccessRetrievalPolicy.cs | 51 +- .../Models/CoolAccessTieringPolicy.cs | 40 +- .../src/Generated/Models/CredentialsStatus.cs | 82 + .../Models/DailySchedule.Serialization.cs | 190 + .../src/Generated/Models/DailySchedule.cs | 51 + .../src/Generated/Models/DayOfWeek.cs | 96 + .../DesiredRansomwareProtectionState.cs | 71 + .../DestinationReplication.Serialization.cs | 183 + .../Models/DestinationReplication.cs | 52 + .../Models/Dimension.Serialization.cs | 152 + .../src/Generated/Models/Dimension.cs | 41 + .../ElasticAccountListResult.Serialization.cs | 177 + .../Models/ElasticAccountListResult.cs | 45 + .../ElasticAccountPatch.Serialization.cs | 213 + .../Generated/Models/ElasticAccountPatch.cs | 66 + .../ElasticAccountProperties.Serialization.cs | 160 + .../Models/ElasticAccountProperties.cs | 41 + ...icAccountUpdateProperties.Serialization.cs | 145 + .../Models/ElasticAccountUpdateProperties.cs | 36 + .../ElasticBackupListResult.Serialization.cs | 177 + .../Models/ElasticBackupListResult.cs | 45 + ...ticBackupPolicyListResult.Serialization.cs | 177 + .../Models/ElasticBackupPolicyListResult.cs | 45 + ...ticBackupPolicyProperties.Serialization.cs | 227 + .../Models/ElasticBackupPolicyProperties.cs | 61 + .../ElasticBackupProperties.Serialization.cs | 330 ++ .../Models/ElasticBackupProperties.cs | 103 + .../src/Generated/Models/ElasticBackupType.cs | 71 + ...sticBackupVaultListResult.Serialization.cs | 177 + .../Models/ElasticBackupVaultListResult.cs | 45 + ...sticBackupVaultProperties.Serialization.cs | 145 + .../Models/ElasticBackupVaultProperties.cs | 36 + ...ticCapacityPoolListResult.Serialization.cs | 177 + .../Models/ElasticCapacityPoolListResult.cs | 45 + .../ElasticCapacityPoolPatch.Serialization.cs | 196 + .../Models/ElasticCapacityPoolPatch.cs | 43 + ...ticCapacityPoolProperties.Serialization.cs | 256 + .../Models/ElasticCapacityPoolProperties.cs | 87 + ...acityPoolUpdateProperties.Serialization.cs | 176 + .../ElasticCapacityPoolUpdateProperties.cs | 47 + .../Models/ElasticEncryption.Serialization.cs | 175 + .../src/Generated/Models/ElasticEncryption.cs | 46 + ...icEncryptionConfiguration.Serialization.cs | 152 + .../Models/ElasticEncryptionConfiguration.cs | 50 + ...ElasticEncryptionIdentity.Serialization.cs | 157 + .../Models/ElasticEncryptionIdentity.cs | 42 + .../ElasticExportPolicy.Serialization.cs | 155 + .../Generated/Models/ElasticExportPolicy.cs | 38 + .../ElasticExportPolicyRule.Serialization.cs | 249 + .../Models/ElasticExportPolicyRule.cs | 63 + ...ElasticKeyVaultProperties.Serialization.cs | 187 + .../Models/ElasticKeyVaultProperties.cs | 52 + .../Generated/Models/ElasticKeyVaultStatus.cs | 86 + ...sticMountTargetProperties.Serialization.cs | 157 + .../Models/ElasticMountTargetProperties.cs | 42 + .../Generated/Models/ElasticNfsv3Access.cs | 71 + .../Generated/Models/ElasticNfsv4Access.cs | 71 + .../Models/ElasticPoolEncryptionKeySource.cs | 71 + .../Generated/Models/ElasticProtocolType.cs | 76 + .../ElasticResourceAvailabilityStatus.cs | 71 + .../src/Generated/Models/ElasticRootAccess.cs | 71 + .../Generated/Models/ElasticServiceLevel.cs | 66 + .../Generated/Models/ElasticSmbEncryption.cs | 71 + ...ElasticSmbPatchProperties.Serialization.cs | 145 + .../Models/ElasticSmbPatchProperties.cs | 36 + .../ElasticSmbProperties.Serialization.cs | 145 + .../Generated/Models/ElasticSmbProperties.cs | 36 + ...ElasticSnapshotListResult.Serialization.cs | 177 + .../Models/ElasticSnapshotListResult.cs | 45 + ...apshotPolicyDailySchedule.Serialization.cs | 175 + .../ElasticSnapshotPolicyDailySchedule.cs | 46 + ...pshotPolicyHourlySchedule.Serialization.cs | 160 + .../ElasticSnapshotPolicyHourlySchedule.cs | 41 + ...cSnapshotPolicyListResult.Serialization.cs | 177 + .../Models/ElasticSnapshotPolicyListResult.cs | 45 + ...shotPolicyMonthlySchedule.Serialization.cs | 200 + .../ElasticSnapshotPolicyMonthlySchedule.cs | 53 + ...cSnapshotPolicyProperties.Serialization.cs | 227 + .../Models/ElasticSnapshotPolicyProperties.cs | 61 + ...cSnapshotPolicyVolumeList.Serialization.cs | 177 + .../Models/ElasticSnapshotPolicyVolumeList.cs | 45 + ...pshotPolicyWeeklySchedule.Serialization.cs | 200 + .../ElasticSnapshotPolicyWeeklySchedule.cs | 53 + ...ElasticSnapshotProperties.Serialization.cs | 145 + .../Models/ElasticSnapshotProperties.cs | 36 + .../Generated/Models/ElasticUnixAccessRule.cs | 76 + ...ticVolumeBackupProperties.Serialization.cs | 176 + .../Models/ElasticVolumeBackupProperties.cs | 47 + ...ProtectionPatchProperties.Serialization.cs | 160 + ...sticVolumeDataProtectionPatchProperties.cs | 59 + ...eDataProtectionProperties.Serialization.cs | 160 + .../ElasticVolumeDataProtectionProperties.cs | 59 + .../ElasticVolumeListResult.Serialization.cs | 177 + .../Models/ElasticVolumeListResult.cs | 45 + .../ElasticVolumePatch.Serialization.cs | 196 + .../Generated/Models/ElasticVolumePatch.cs | 43 + .../Models/ElasticVolumePolicyEnforcement.cs | 71 + .../ElasticVolumeProperties.Serialization.cs | 344 ++ .../Models/ElasticVolumeProperties.cs | 140 + .../Models/ElasticVolumeRestorationState.cs | 76 + .../ElasticVolumeRevert.Serialization.cs | 158 + .../Generated/Models/ElasticVolumeRevert.cs | 37 + ...cVolumeSnapshotProperties.Serialization.cs | 146 + .../Models/ElasticVolumeSnapshotProperties.cs | 37 + ...ticVolumeUpdateProperties.Serialization.cs | 211 + .../Models/ElasticVolumeUpdateProperties.cs | 86 + .../Generated/Models/EnableNetAppSubvolume.cs | 51 - .../src/Generated/Models/EnableSubvolumes.cs | 71 + .../Generated/Models/EnableWriteBackState.cs | 71 + .../EncryptionIdentity.Serialization.cs | 163 + .../Generated/Models/EncryptionIdentity.cs | 46 + .../Generated/Models/EncryptionKeySource.cs | 71 + .../src/Generated/Models/EncryptionState.cs | 71 + ...cryptionTransitionRequest.Serialization.cs | 164 + .../Models/EncryptionTransitionRequest.cs | 51 + .../src/Generated/Models/Exclude.cs | 71 + .../Models/ExportPolicyRule.Serialization.cs | 367 ++ .../src/Generated/Models/ExportPolicyRule.cs | 106 + .../Models/ExternalReplicationSetupStatus.cs | 50 +- .../src/Generated/Models/FileAccessLogs.cs | 71 + ...lePathAvailabilityRequest.Serialization.cs | 180 + .../Models/FilePathAvailabilityRequest.cs | 55 + .../Models/FileSystemUser.Serialization.cs | 160 + .../src/Generated/Models/FileSystemUser.cs | 58 + ...pIdListForLdapUserContent.Serialization.cs | 126 - .../GetGroupIdListForLdapUserContent.cs | 75 - ...pIdListForLdapUserRequest.Serialization.cs | 156 + .../GetGroupIdListForLdapUserRequest.cs | 42 + ...IdListForLdapUserResponse.Serialization.cs | 176 + .../GetGroupIdListForLdapUserResponse.cs | 38 + ...upIdListForLdapUserResult.Serialization.cs | 143 - .../Models/GetGroupIdListForLdapUserResult.cs | 66 - ...GetKeyVaultStatusResponse.Serialization.cs | 154 + .../Models/GetKeyVaultStatusResponse.cs | 73 + ...tStatusResponseProperties.Serialization.cs | 197 + .../GetKeyVaultStatusResponseProperties.cs | 54 + .../Models/GlobalFileLockingState.cs | 71 + .../Models/HourlySchedule.Serialization.cs | 175 + .../src/Generated/Models/HourlySchedule.cs | 46 + .../Models/InAvailabilityReasonType.cs | 69 + .../src/Generated/Models/KerberosState.cs | 71 + .../src/Generated/Models/KeySource.cs | 71 + .../KeyVaultPrivateEndpoint.Serialization.cs | 161 + .../Models/KeyVaultPrivateEndpoint.cs | 42 + .../KeyVaultProperties.Serialization.cs | 199 + .../Generated/Models/KeyVaultProperties.cs | 66 + .../src/Generated/Models/LargeVolumeType.cs | 75 + .../Models/LdapConfiguration.Serialization.cs | 131 +- .../src/Generated/Models/LdapConfiguration.cs | 50 +- .../LdapSearchScopeOpt.Serialization.cs | 163 + .../Generated/Models/LdapSearchScopeOpt.cs | 46 + .../src/Generated/Models/LdapServerType.cs | 40 +- .../src/Generated/Models/LdapState.cs | 71 + .../ListQuotaReportResponse.Serialization.cs | 164 + .../Models/ListQuotaReportResponse.cs | 38 + .../Models/ListReplications.Serialization.cs | 122 +- .../src/Generated/Models/ListReplications.cs | 56 +- .../ListReplicationsRequest.Serialization.cs | 158 + .../Models/ListReplicationsRequest.cs | 36 + .../Models/LogSpecification.Serialization.cs | 152 + .../src/Generated/Models/LogSpecification.cs | 41 + .../Generated/Models/MetricAggregationType.cs | 65 + .../MetricSpecification.Serialization.cs | 389 ++ .../Generated/Models/MetricSpecification.cs | 115 + .../Models/MonthlySchedule.Serialization.cs | 207 + .../src/Generated/Models/MonthlySchedule.cs | 56 + .../MountTargetProperties.Serialization.cs | 176 + .../Generated/Models/MountTargetProperties.cs | 53 + .../src/Generated/Models/MultiAdStatus.cs | 38 +- .../NetAppAccountActiveDirectoryStatus.cs | 60 - .../NetAppAccountEncryption.Serialization.cs | 163 - .../Models/NetAppAccountEncryption.cs | 73 - .../Models/NetAppAccountList.Serialization.cs | 117 +- .../src/Generated/Models/NetAppAccountList.cs | 59 +- .../NetAppAccountPatch.Serialization.cs | 330 +- .../Generated/Models/NetAppAccountPatch.cs | 192 +- .../Generated/Models/NetAppApplicationType.cs | 42 +- .../Generated/Models/NetAppAvsDataStore.cs | 51 - .../NetAppBackupPolicyPatch.Serialization.cs | 311 -- .../Models/NetAppBackupPolicyPatch.cs | 108 - .../src/Generated/Models/NetAppBackupType.cs | 38 +- ...AppBackupVaultBackupPatch.Serialization.cs | 144 - .../Models/NetAppBackupVaultBackupPatch.cs | 65 - .../NetAppBackupVaultPatch.Serialization.cs | 144 - .../Models/NetAppBackupVaultPatch.cs | 66 - .../Models/NetAppBucketCredentialStatus.cs | 60 - ...ppBucketCredentialsExpiry.Serialization.cs | 133 - .../Models/NetAppBucketCredentialsExpiry.cs | 65 - ...etAppBucketFileSystemUser.Serialization.cs | 148 - .../Models/NetAppBucketFileSystemUser.cs | 80 - ...BucketGenerateCredentials.Serialization.cs | 155 - .../Models/NetAppBucketGenerateCredentials.cs | 73 - .../Models/NetAppBucketList.Serialization.cs | 154 - .../src/Generated/Models/NetAppBucketList.cs | 70 - .../NetAppBucketNfsUser.Serialization.cs | 148 - .../Generated/Models/NetAppBucketNfsUser.cs | 69 - .../Models/NetAppBucketPatch.Serialization.cs | 230 - .../src/Generated/Models/NetAppBucketPatch.cs | 87 - .../Models/NetAppBucketPatchPermission.cs | 51 - .../Models/NetAppBucketPermission.cs | 51 - ...cketServerPatchProperties.Serialization.cs | 140 - .../NetAppBucketServerPatchProperties.cs | 69 - ...AppBucketServerProperties.Serialization.cs | 183 - .../Models/NetAppBucketServerProperties.cs | 81 - .../NetAppChangeKeyVault.Serialization.cs | 167 - ...ppCheckAvailabilityResult.Serialization.cs | 159 - .../src/Generated/Models/NetAppChownMode.cs | 51 - ...AppDestinationReplication.Serialization.cs | 170 - .../Models/NetAppDestinationReplication.cs | 78 - .../NetAppEncryptionIdentity.Serialization.cs | 151 - .../Models/NetAppEncryptionIdentity.cs | 73 - .../Models/NetAppEncryptionKeySource.cs | 51 - ...cryptionTransitionContent.Serialization.cs | 134 - .../NetAppEncryptionTransitionContent.cs | 83 - .../Generated/Models/NetAppEndpointType.cs | 42 +- .../Generated/Models/NetAppFileAccessLog.cs | 51 - ...lePathAvailabilityContent.Serialization.cs | 157 - .../NetAppFilePathAvailabilityContent.cs | 87 - .../Models/NetAppFileServiceLevel.cs | 52 +- .../src/Generated/Models/NetAppKeySource.cs | 51 - ...ppKeyVaultPrivateEndpoint.Serialization.cs | 148 - .../Models/NetAppKeyVaultPrivateEndpoint.cs | 70 - .../NetAppKeyVaultProperties.Serialization.cs | 181 - .../Models/NetAppKeyVaultProperties.cs | 95 - .../Generated/Models/NetAppKeyVaultStatus.cs | 50 +- ...etAppKeyVaultStatusResult.Serialization.cs | 199 - .../Models/NetAppKeyVaultStatusResult.cs | 79 - ...pSearchScopeConfiguration.Serialization.cs | 151 - .../NetAppLdapSearchScopeConfiguration.cs | 73 - .../src/Generated/Models/NetAppMirrorState.cs | 47 +- ...ppNameAvailabilityContent.Serialization.cs | 142 - .../Models/NetAppNameAvailabilityContent.cs | 88 - .../NetAppNameAvailabilityResourceType.cs | 57 - .../Models/NetAppNameUnavailableReason.cs | 51 - .../Generated/Models/NetAppNetworkFeature.cs | 57 - .../NetAppProvisioningState.Serialization.cs | 40 - .../Models/NetAppProvisioningState.cs | 77 + ...pQuotaAvailabilityContent.Serialization.cs | 142 - .../Models/NetAppQuotaAvailabilityContent.cs | 88 - .../NetAppQuotaAvailabilityResourceType.cs | 57 - .../Models/NetAppRegionInfo.Serialization.cs | 158 - .../src/Generated/Models/NetAppRegionInfo.cs | 70 - .../Models/NetAppRelationshipStatus.cs | 17 - .../Models/NetAppReplicationSchedule.cs | 54 - .../Generated/Models/NetAppReplicationType.cs | 51 - .../NetAppRestoreStatus.Serialization.cs | 117 +- .../Generated/Models/NetAppRestoreStatus.cs | 56 +- ...tAppSubscriptionQuotaItem.Serialization.cs | 210 - .../Models/NetAppSubscriptionQuotaItem.cs | 79 - .../NetAppSubvolumeInfoPatch.Serialization.cs | 167 - .../Models/NetAppSubvolumeInfoPatch.cs | 69 - .../NetAppSubvolumeMetadata.Serialization.cs | 298 -- .../Models/NetAppSubvolumeMetadata.cs | 107 - .../Models/NetAppUsageName.Serialization.cs | 140 - .../src/Generated/Models/NetAppUsageName.cs | 69 - .../Models/NetAppUsageResult.Serialization.cs | 206 - .../src/Generated/Models/NetAppUsageResult.cs | 81 - ...thorizeReplicationContent.Serialization.cs | 133 - ...NetAppVolumeAuthorizeReplicationContent.cs | 66 - ...BackupRestoreFilesContent.Serialization.cs | 155 - ...ppVolumeBackupBackupRestoreFilesContent.cs | 88 - ...VolumeBackupConfiguration.Serialization.cs | 163 - .../Models/NetAppVolumeBackupConfiguration.cs | 69 - .../NetAppVolumeBackupDetail.Serialization.cs | 174 - .../Models/NetAppVolumeBackupDetail.cs | 78 - .../NetAppVolumeBackupStatus.Serialization.cs | 133 +- .../Models/NetAppVolumeBackupStatus.cs | 59 +- ...lumeBreakFileLocksContent.Serialization.cs | 149 - .../NetAppVolumeBreakFileLocksContent.cs | 70 - ...meBreakReplicationContent.Serialization.cs | 133 - .../NetAppVolumeBreakReplicationContent.cs | 65 - ...etAppVolumeDataProtection.Serialization.cs | 178 - .../Models/NetAppVolumeDataProtection.cs | 90 - ...AppVolumeExportPolicyRule.Serialization.cs | 312 +- .../Models/NetAppVolumeExportPolicyRule.cs | 109 +- ...NetAppVolumeGroupMetadata.Serialization.cs | 201 - .../Models/NetAppVolumeGroupMetadata.cs | 82 - .../NetAppVolumeGroupResult.Serialization.cs | 198 - .../Models/NetAppVolumeGroupResult.cs | 79 - .../NetAppVolumeGroupVolume.Serialization.cs | 1286 ----- .../Generated/Models/NetAppVolumeLanguage.cs | 252 - .../NetAppVolumeMountTarget.Serialization.cs | 168 - .../Models/NetAppVolumeMountTarget.cs | 85 - .../Models/NetAppVolumePatch.Serialization.cs | 475 -- ...VolumePatchDataProtection.Serialization.cs | 148 - .../Models/NetAppVolumePatchDataProtection.cs | 81 - ...NetAppVolumePlacementRule.Serialization.cs | 81 +- .../Models/NetAppVolumePlacementRule.cs | 46 +- ...ppVolumePoolChangeContent.Serialization.cs | 126 - .../Models/NetAppVolumePoolChangeContent.cs | 76 - .../NetAppVolumeQuotaReport.Serialization.cs | 211 - ...lumeQuotaReportListResult.Serialization.cs | 143 - .../NetAppVolumeQuotaReportListResult.cs | 66 - ...etAppVolumeQuotaRulePatch.Serialization.cs | 221 - .../Models/NetAppVolumeQuotaRulePatch.cs | 82 - .../Generated/Models/NetAppVolumeQuotaType.cs | 57 - ...tablishReplicationContent.Serialization.cs | 133 - ...tAppVolumeReestablishReplicationContent.cs | 66 - ...olumeRelocationProperties.Serialization.cs | 148 - .../NetAppVolumeRelocationProperties.cs | 69 - .../NetAppVolumeReplication.Serialization.cs | 184 - .../Models/NetAppVolumeReplication.cs | 92 - ...ppVolumeReplicationStatus.Serialization.cs | 191 - .../Models/NetAppVolumeReplicationStatus.cs | 81 - ...NetAppVolumeRevertContent.Serialization.cs | 129 - .../Models/NetAppVolumeRevertContent.cs | 65 - .../Models/NetAppVolumeSecurityStyle.cs | 51 - ...apshotRestoreFilesContent.Serialization.cs | 147 - ...NetAppVolumeSnapshotRestoreFilesContent.cs | 80 - .../NetAppVolumeStorageToNetworkProximity.cs | 57 - .../src/Generated/Models/NetworkFeatures.cs | 81 + .../Models/NetworkSiblingSet.Serialization.cs | 114 +- .../src/Generated/Models/NetworkSiblingSet.cs | 47 +- .../NetworkSiblingSetProvisioningState.cs | 50 +- .../Generated/Models/NfsUser.Serialization.cs | 160 + .../src/Generated/Models/NfsUser.cs | 41 + .../Generated/Models/NicInfo.Serialization.cs | 85 +- .../src/Generated/Models/NicInfo.cs | 45 +- .../Models/Operation.Serialization.cs | 182 + .../src/Generated/Models/Operation.cs | 60 + .../Models/OperationDisplay.Serialization.cs | 174 + .../src/Generated/Models/OperationDisplay.cs | 51 + .../OperationListResult.Serialization.cs | 177 + .../Generated/Models/OperationListResult.cs | 44 + .../OperationProperties.Serialization.cs | 145 + .../Generated/Models/OperationProperties.cs | 36 + .../OriginClusterInformation.Serialization.cs | 189 + .../Models/OriginClusterInformation.cs | 67 + ...ForVolumeMigrationContent.Serialization.cs | 136 - .../PeerClusterForVolumeMigrationContent.cs | 76 - ...ForVolumeMigrationRequest.Serialization.cs | 178 + .../PeerClusterForVolumeMigrationRequest.cs | 43 + .../PeeringPassphrases.Serialization.cs | 168 + .../Generated/Models/PeeringPassphrases.cs | 52 + .../src/Generated/Models/PolicyState.cs | 71 + .../src/Generated/Models/PolicyStatus.cs | 71 + .../Models/PoolChangeRequest.Serialization.cs | 156 + .../src/Generated/Models/PoolChangeRequest.cs | 42 + .../PoolPatchProperties.Serialization.cs | 191 + .../Generated/Models/PoolPatchProperties.cs | 51 + .../Models/PoolProperties.Serialization.cs | 276 ++ .../src/Generated/Models/PoolProperties.cs | 85 + .../src/Generated/Models/ProtocolTypes.cs | 76 + .../src/Generated/Models/QosType.cs | 71 + ...yNetworkSiblingSetContent.Serialization.cs | 134 - ...yNetworkSiblingSetRequest.Serialization.cs | 164 + ...nt.cs => QueryNetworkSiblingSetRequest.cs} | 54 +- .../QuotaAvailabilityRequest.Serialization.cs | 172 + .../Models/QuotaAvailabilityRequest.cs | 57 + .../Models/QuotaItemList.Serialization.cs | 121 +- .../src/Generated/Models/QuotaItemList.cs | 59 +- .../QuotaItemProperties.Serialization.cs | 176 + .../Generated/Models/QuotaItemProperties.cs | 46 + .../Models/QuotaReport.Serialization.cs | 223 + ...AppVolumeQuotaReport.cs => QuotaReport.cs} | 54 +- ...reProtectionPatchSettings.Serialization.cs | 145 + .../RansomwareProtectionPatchSettings.cs | 36 + ...somwareProtectionSettings.Serialization.cs | 160 + .../Models/RansomwareProtectionSettings.cs | 41 + ...ansomwareReportProperties.Serialization.cs | 255 + .../Models/RansomwareReportProperties.cs | 74 + .../Models/RansomwareReportSeverity.cs | 81 + .../Generated/Models/RansomwareReportState.cs | 71 + .../RansomwareReportsList.Serialization.cs | 177 + .../Generated/Models/RansomwareReportsList.cs | 45 + .../Models/RansomwareSuspectResolution.cs | 71 + .../RansomwareSuspects.Serialization.cs | 196 + .../Generated/Models/RansomwareSuspects.cs | 53 + ...mwareSuspectsClearRequest.Serialization.cs | 186 + .../Models/RansomwareSuspectsClearRequest.cs | 50 + ...tablishReplicationRequest.Serialization.cs | 154 + .../Models/ReestablishReplicationRequest.cs | 36 + .../Models/RegionInfo.Serialization.cs | 179 + .../src/Generated/Models/RegionInfo.cs | 43 + .../Models/RegionInfosList.Serialization.cs | 154 - .../src/Generated/Models/RegionInfosList.cs | 70 - .../Models/RegionStorageToNetworkProximity.cs | 58 +- .../RelocateVolumeContent.Serialization.cs | 129 - .../Generated/Models/RelocateVolumeContent.cs | 65 - .../RelocateVolumeRequest.Serialization.cs | 154 + .../Generated/Models/RelocateVolumeRequest.cs | 36 + .../Models/RemotePath.Serialization.cs | 85 +- .../src/Generated/Models/RemotePath.cs | 47 +- .../Models/Replication.Serialization.cs | 249 + .../src/Generated/Models/Replication.cs | 73 + .../Models/ReplicationMirrorState.cs | 76 + ....cs => ReplicationObject.Serialization.cs} | 166 +- ...licationObject.cs => ReplicationObject.cs} | 76 +- .../Generated/Models/ReplicationSchedule.cs | 73 + .../Models/ReplicationStatus.Serialization.cs | 212 + .../src/Generated/Models/ReplicationStatus.cs | 56 + .../src/Generated/Models/ReplicationType.cs | 71 + ...ceNameAvailabilityRequest.Serialization.cs | 172 + .../Models/ResourceNameAvailabilityRequest.cs | 57 + .../Models/SecretPassword.Serialization.cs | 160 + .../src/Generated/Models/SecretPassword.cs | 41 + .../SecretPasswordIdentity.Serialization.cs | 152 + .../Models/SecretPasswordIdentity.cs | 41 + ...asswordKeyVaultProperties.Serialization.cs | 151 + .../SecretPasswordKeyVaultProperties.cs | 50 + .../src/Generated/Models/SecurityStyle.cs | 69 + .../ServiceSpecification.Serialization.cs | 180 + .../Generated/Models/ServiceSpecification.cs | 44 + .../Models/SmbAccessBasedEnumeration.cs | 38 +- .../Generated/Models/SmbEncryptionState.cs | 71 + .../src/Generated/Models/SmbNonBrowsable.cs | 38 +- .../Models/SmbSettings.Serialization.cs | 175 + .../src/Generated/Models/SmbSettings.cs | 46 + .../Models/SnapshotDirectoryVisibility.cs | 71 + .../Models/SnapshotPatch.Serialization.cs | 143 + .../src/Generated/Models/SnapshotPatch.cs | 31 + .../SnapshotPoliciesList.Serialization.cs | 120 +- .../Generated/Models/SnapshotPoliciesList.cs | 57 +- ...apshotPolicyDailySchedule.Serialization.cs | 178 - .../Models/SnapshotPolicyDailySchedule.cs | 77 - ...pshotPolicyHourlySchedule.Serialization.cs | 163 - .../Models/SnapshotPolicyHourlySchedule.cs | 73 - ...shotPolicyMonthlySchedule.Serialization.cs | 195 - .../Models/SnapshotPolicyMonthlySchedule.cs | 81 - .../SnapshotPolicyPatch.Serialization.cs | 278 +- .../Generated/Models/SnapshotPolicyPatch.cs | 190 +- .../SnapshotPolicyProperties.Serialization.cs | 223 + .../Models/SnapshotPolicyProperties.cs | 61 + .../SnapshotPolicyVolumeList.Serialization.cs | 122 +- .../Models/SnapshotPolicyVolumeList.cs | 59 +- ...pshotPolicyWeeklySchedule.Serialization.cs | 195 - .../Models/SnapshotPolicyWeeklySchedule.cs | 81 - .../SnapshotProperties.Serialization.cs | 167 + .../Generated/Models/SnapshotProperties.cs | 46 + .../SnapshotRestoreFiles.Serialization.cs | 189 + .../Generated/Models/SnapshotRestoreFiles.cs | 48 + .../src/Generated/Models/SnapshotUsage.cs | 71 + .../Models/SnapshotsList.Serialization.cs | 122 +- .../src/Generated/Models/SnapshotsList.cs | 57 +- .../SubvolumeInfoPatch.Serialization.cs | 158 + .../Generated/Models/SubvolumeInfoPatch.cs | 70 + .../Models/SubvolumeModel.Serialization.cs | 187 + .../src/Generated/Models/SubvolumeModel.cs | 141 + .../SubvolumeModelProperties.Serialization.cs | 275 ++ .../Models/SubvolumeModelProperties.cs | 81 + .../SubvolumePatchParams.Serialization.cs | 157 + .../Generated/Models/SubvolumePatchParams.cs | 41 + .../SubvolumeProperties.Serialization.cs | 184 + .../Generated/Models/SubvolumeProperties.cs | 51 + .../Models/SubvolumesList.Serialization.cs | 121 +- .../src/Generated/Models/SubvolumesList.cs | 59 +- .../Models/SuspectFile.Serialization.cs | 156 + .../src/Generated/Models/SuspectFile.cs | 41 + .../SvmPeerCommandResponse.Serialization.cs | 150 + .../Models/SvmPeerCommandResponse.cs | 36 + .../SvmPeerCommandResult.Serialization.cs | 129 - .../Generated/Models/SvmPeerCommandResult.cs | 65 - .../src/Generated/Models/Type.cs | 81 + ...eNetworkSiblingSetContent.Serialization.cs | 150 - ...eNetworkSiblingSetRequest.Serialization.cs | 180 + ...t.cs => UpdateNetworkSiblingSetRequest.cs} | 58 +- .../Models/UsageName.Serialization.cs | 152 + .../src/Generated/Models/UsageName.cs | 41 + .../Models/UsageProperties.Serialization.cs | 171 + .../src/Generated/Models/UsageProperties.cs | 46 + .../Models/UsageResult.Serialization.cs | 180 + .../src/Generated/Models/UsageResult.cs | 73 + .../Models/UsagesListResult.Serialization.cs | 121 +- .../src/Generated/Models/UsagesListResult.cs | 58 +- .../VolumeBackupProperties.Serialization.cs | 176 + .../Models/VolumeBackupProperties.cs | 47 + .../Models/VolumeBackupRelationshipStatus.cs | 77 + .../Models/VolumeBackups.Serialization.cs | 187 + .../src/Generated/Models/VolumeBackups.cs | 52 + .../Models/VolumeGroup.Serialization.cs | 195 + .../src/Generated/Models/VolumeGroup.cs | 74 + .../Models/VolumeGroupList.Serialization.cs | 122 +- .../src/Generated/Models/VolumeGroupList.cs | 56 +- ...VolumeGroupListProperties.Serialization.cs | 156 + .../Models/VolumeGroupListProperties.cs | 41 + .../VolumeGroupMetaData.Serialization.cs | 213 + .../Generated/Models/VolumeGroupMetaData.cs | 58 + .../VolumeGroupProperties.Serialization.cs | 181 + .../Generated/Models/VolumeGroupProperties.cs | 48 + ...lumeGroupVolumeProperties.Serialization.cs | 258 + .../Models/VolumeGroupVolumeProperties.cs | 990 ++++ .../src/Generated/Models/VolumeLanguage.cs | 406 ++ .../Models/VolumeList.Serialization.cs | 121 +- .../src/Generated/Models/VolumeList.cs | 59 +- .../Models/VolumePatch.Serialization.cs | 247 + .../src/Generated/Models/VolumePatch.cs | 353 ++ .../VolumePatchProperties.Serialization.cs | 427 ++ ...olumePatch.cs => VolumePatchProperties.cs} | 132 +- ...hPropertiesDataProtection.Serialization.cs | 175 + .../VolumePatchPropertiesDataProtection.cs | 80 + ...tchPropertiesExportPolicy.Serialization.cs | 84 +- .../VolumePatchPropertiesExportPolicy.cs | 44 +- .../Models/VolumeProperties.Serialization.cs | 1137 +++++ ...lumeGroupVolume.cs => VolumeProperties.cs} | 300 +- ...ePropertiesDataProtection.Serialization.cs | 211 + .../Models/VolumePropertiesDataProtection.cs | 73 + ...umePropertiesExportPolicy.Serialization.cs | 143 - .../Models/VolumePropertiesExportPolicy.cs | 66 - .../VolumeQuotaRulePatch.Serialization.cs | 196 + .../Generated/Models/VolumeQuotaRulePatch.cs | 103 + .../VolumeQuotaRulesList.Serialization.cs | 122 +- .../Generated/Models/VolumeQuotaRulesList.cs | 57 +- ...olumeQuotaRulesProperties.Serialization.cs | 186 + .../Models/VolumeQuotaRulesProperties.cs | 51 + ...olumeRelocationProperties.Serialization.cs | 160 + .../Models/VolumeRelocationProperties.cs | 41 + .../VolumeReplicationRelationshipStatus.cs | 42 +- .../Models/VolumeRestoreRelationshipStatus.cs | 77 + .../Models/VolumeRevert.Serialization.cs | 158 + .../src/Generated/Models/VolumeRevert.cs | 37 + .../src/Generated/Models/VolumeSize.cs | 71 + .../VolumeSnapshotProperties.Serialization.cs | 80 +- .../Models/VolumeSnapshotProperties.cs | 42 +- .../Models/VolumeStorageToNetworkProximity.cs | 81 + .../Models/WeeklySchedule.Serialization.cs | 207 + .../src/Generated/Models/WeeklySchedule.cs | 56 + .../src/Generated/NetAppAccountCollection.cs | 412 +- .../NetAppAccountData.Serialization.cs | 328 +- .../src/Generated/NetAppAccountData.cs | 185 +- .../NetAppAccountResource.Serialization.cs | 21 +- .../src/Generated/NetAppAccountResource.cs | 1691 +++---- .../NetAppBackupData.Serialization.cs | 368 -- .../Generated/NetAppBackupPolicyCollection.cs | 491 -- .../NetAppBackupPolicyData.Serialization.cs | 328 -- .../src/Generated/NetAppBackupPolicyData.cs | 116 - ...etAppBackupPolicyResource.Serialization.cs | 29 - .../Generated/NetAppBackupPolicyResource.cs | 707 --- .../NetAppBackupVaultBackupCollection.cs | 495 -- ...BackupVaultBackupResource.Serialization.cs | 29 - .../NetAppBackupVaultBackupResource.cs | 437 -- .../Generated/NetAppBackupVaultCollection.cs | 493 -- .../NetAppBackupVaultData.Serialization.cs | 189 - .../src/Generated/NetAppBackupVaultData.cs | 82 - ...NetAppBackupVaultResource.Serialization.cs | 29 - .../Generated/NetAppBackupVaultResource.cs | 776 --- .../src/Generated/NetAppBucketCollection.cs | 493 -- .../NetAppBucketData.Serialization.cs | 247 - .../src/Generated/NetAppBucketData.cs | 107 - .../NetAppBucketResource.Serialization.cs | 29 - .../src/Generated/NetAppBucketResource.cs | 434 -- ...tsAccountGetAllAsyncCollectionResultOfT.cs | 89 + ...aLimitsAccountGetAllCollectionResultOfT.cs | 88 + ...otaLimitsGetAllAsyncCollectionResultOfT.cs | 81 + ...rceQuotaLimitsGetAllCollectionResultOfT.cs | 80 + ...rceUsagesGetAllAsyncCollectionResultOfT.cs | 85 + ...ResourceUsagesGetAllCollectionResultOfT.cs | 84 + .../NetAppSubscriptionQuotaItemCollection.cs | 446 ++ ...SubscriptionQuotaItemData.Serialization.cs | 185 + .../NetAppSubscriptionQuotaItemData.cs | 70 + ...criptionQuotaItemResource.Serialization.cs | 39 + .../NetAppSubscriptionQuotaItemResource.cs | 293 ++ .../NetAppSubvolumeInfoCollection.cs | 493 -- .../NetAppSubvolumeInfoData.Serialization.cs | 226 - .../src/Generated/NetAppSubvolumeInfoData.cs | 86 - ...tAppSubvolumeInfoResource.Serialization.cs | 29 - .../Generated/NetAppSubvolumeInfoResource.cs | 434 -- .../src/Generated/NetAppVolumeCollection.cs | 493 -- .../NetAppVolumeData.Serialization.cs | 1275 ----- .../src/Generated/NetAppVolumeData.cs | 361 -- .../Generated/NetAppVolumeGroupCollection.cs | 415 -- .../NetAppVolumeGroupData.Serialization.cs | 225 - .../src/Generated/NetAppVolumeGroupData.cs | 88 - ...NetAppVolumeGroupResource.Serialization.cs | 29 - .../Generated/NetAppVolumeGroupResource.cs | 347 -- .../NetAppVolumeQuotaRuleCollection.cs | 491 -- ...NetAppVolumeQuotaRuleData.Serialization.cs | 238 - .../Generated/NetAppVolumeQuotaRuleData.cs | 95 - ...ppVolumeQuotaRuleResource.Serialization.cs | 29 - .../NetAppVolumeQuotaRuleResource.cs | 709 --- .../NetAppVolumeResource.Serialization.cs | 29 - .../src/Generated/NetAppVolumeResource.cs | 3184 ------------- .../NetAppVolumeSnapshotCollection.cs | 491 -- .../NetAppVolumeSnapshotData.Serialization.cs | 203 - .../src/Generated/NetAppVolumeSnapshotData.cs | 93 - ...AppVolumeSnapshotResource.Serialization.cs | 29 - .../Generated/NetAppVolumeSnapshotResource.cs | 442 -- ...perationsGetAllAsyncCollectionResultOfT.cs | 75 + .../OperationsGetAllCollectionResultOfT.cs | 74 + .../PoolsGetAllAsyncCollectionResultOfT.cs | 89 + .../PoolsGetAllCollectionResultOfT.cs | 88 + .../src/Generated/ProviderConstants.cs | 3 +- .../Generated/RansomwareReportCollection.cs | 467 ++ .../RansomwareReportData.Serialization.cs | 190 + .../src/Generated/RansomwareReportData.cs | 48 + .../RansomwareReportResource.Serialization.cs | 39 + .../src/Generated/RansomwareReportResource.cs | 305 ++ ...reReportsGetAllAsyncCollectionResultOfT.cs | 97 + ...somwareReportsGetAllCollectionResultOfT.cs | 96 + .../RegionInfoResource.Serialization.cs | 18 +- .../src/Generated/RegionInfoResource.cs | 113 +- .../Generated/RegionInfoResourceCollection.cs | 369 -- .../RegionInfoResourceData.Serialization.cs | 156 +- .../src/Generated/RegionInfoResourceData.cs | 81 +- .../RestOperations/AccountsRestOperations.cs | 1047 +---- .../ActiveDirectoryConfigsRestOperations.cs | 181 + .../BackupPoliciesRestOperations.cs | 502 +- .../BackupVaultsRestOperations.cs | 578 +-- .../RestOperations/BackupsRestOperations.cs | 836 +--- .../BackupsUnderAccountRestOperations.cs | 121 +- .../BackupsUnderBackupVaultRestOperations.cs | 133 +- .../BackupsUnderVolumeRestOperations.cs | 133 +- .../RestOperations/BucketsRestOperations.cs | 764 +-- .../RestOperations/CachesRestOperations.cs | 223 + .../ElasticAccountsRestOperations.cs | 181 + .../ElasticBackupPoliciesRestOperations.cs | 163 + .../ElasticBackupVaultsRestOperations.cs | 163 + .../ElasticBackupsRestOperations.cs | 173 + .../ElasticCapacityPoolsRestOperations.cs | 211 + .../ElasticSnapshotPoliciesRestOperations.cs | 197 + .../ElasticSnapshotsRestOperations.cs | 156 + .../ElasticVolumesRestOperations.cs | 199 + ...esourceQuotaLimitsAccountRestOperations.cs | 304 +- ...NetAppResourceQuotaLimitsRestOperations.cs | 286 +- ...NetAppResourceRegionInfosRestOperations.cs | 285 +- .../NetAppResourceRestOperations.cs | 557 +-- .../NetAppResourceUsagesRestOperations.cs | 284 +- .../OperationsRestOperations.cs | 70 + .../RestOperations/PoolsRestOperations.cs | 578 +-- .../RansomwareReportsRestOperations.cs | 132 + .../SnapshotPoliciesRestOperations.cs | 604 +-- .../RestOperations/SnapshotsRestOperations.cs | 557 +-- .../SubvolumesRestOperations.cs | 752 +-- .../VolumeGroupsRestOperations.cs | 405 +- .../VolumeQuotaRulesRestOperations.cs | 560 +-- .../RestOperations/VolumesRestOperations.cs | 2968 ++---------- .../src/Generated/SnapshotCollection.cs | 561 +++ .../Generated/SnapshotData.Serialization.cs | 211 + .../src/Generated/SnapshotData.cs | 79 + ...tPoliciesGetAllAsyncCollectionResultOfT.cs | 89 + ...apshotPoliciesGetAllCollectionResultOfT.cs | 88 + .../src/Generated/SnapshotPolicyCollection.cs | 398 +- .../SnapshotPolicyData.Serialization.cs | 269 +- .../src/Generated/SnapshotPolicyData.cs | 179 +- .../SnapshotPolicyResource.Serialization.cs | 18 +- .../src/Generated/SnapshotPolicyResource.cs | 665 +-- .../SnapshotResource.Serialization.cs | 39 + .../src/Generated/SnapshotResource.cs | 515 ++ ...SnapshotsGetAllAsyncCollectionResultOfT.cs | 97 + .../SnapshotsGetAllCollectionResultOfT.cs | 96 + .../src/Generated/SubvolumeInfoCollection.cs | 561 +++ .../SubvolumeInfoData.Serialization.cs | 197 + .../src/Generated/SubvolumeInfoData.cs | 103 + .../SubvolumeInfoResource.Serialization.cs | 39 + .../src/Generated/SubvolumeInfoResource.cs | 519 ++ ...umesGetByVolumeAsyncCollectionResultOfT.cs | 97 + ...ubvolumesGetByVolumeCollectionResultOfT.cs | 96 + .../src/Generated/VolumeCollection.cs | 567 +++ .../src/Generated/VolumeData.Serialization.cs | 275 ++ .../src/Generated/VolumeData.cs | 982 ++++ .../Generated/VolumeGroupDetailsCollection.cs | 505 ++ .../VolumeGroupDetailsData.Serialization.cs | 209 + .../src/Generated/VolumeGroupDetailsData.cs | 87 + ...olumeGroupDetailsResource.Serialization.cs | 39 + .../Generated/VolumeGroupDetailsResource.cs | 406 ++ ...ByNetAppAccountAsyncCollectionResultOfT.cs | 89 + ...psGetByNetAppAccountCollectionResultOfT.cs | 88 + .../Generated/VolumeQuotaRuleCollection.cs | 561 +++ .../VolumeQuotaRuleData.Serialization.cs | 232 + .../src/Generated/VolumeQuotaRuleData.cs | 106 + .../VolumeQuotaRuleResource.Serialization.cs | 39 + .../src/Generated/VolumeQuotaRuleResource.cs | 685 +++ ...ulesGetByVolumeAsyncCollectionResultOfT.cs | 97 + ...uotaRulesGetByVolumeCollectionResultOfT.cs | 96 + .../Generated/VolumeResource.Serialization.cs | 39 + .../src/Generated/VolumeResource.cs | 3487 ++++++++++++++ .../VolumesGetAllAsyncCollectionResultOfT.cs | 93 + .../VolumesGetAllCollectionResultOfT.cs | 92 + ...GetReplicationsAsyncCollectionResultOfT.cs | 101 + ...lumesGetReplicationsCollectionResultOfT.cs | 100 + .../src/{autorest.md => autorest.md.bak} | 3 - .../tsp-location.yaml | 4 + .../tsp_client_metadata.yaml | 24 + 968 files changed, 104959 insertions(+), 58241 deletions(-) delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/ApiCompatBaseline.txt create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetBySubscriptionAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetBySubscriptionCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetByResourceGroupAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetByResourceGroupCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetBySubscriptionAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetBySubscriptionCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPoliciesGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPoliciesGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultsGetByNetAppAccountAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultsGetByNetAppAccountCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupsGetByVaultAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupsGetByVaultCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketsGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketsGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CachesGetByCapacityPoolsAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CachesGetByCapacityPoolsCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetByResourceGroupAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetByResourceGroupCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetBySubscriptionAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetBySubscriptionCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPoliciesGetByElasticAccountAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPoliciesGetByElasticAccountCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultsGetByElasticAccountAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultsGetByElasticAccountCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupsGetByVaultAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupsGetByVaultCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolsGetByNetAppAccountAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolsGetByNetAppAccountCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetByElasticAccountAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetByElasticAccountCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetVolumesAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetVolumesCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotsGetByElasticVolumeAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotsGetByElasticVolumeCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumesGetByElasticPoolAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumesGetByElasticPoolCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppTenantResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/AsyncPageableWrapper.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ClientPipelineExtensions.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenMemberAttribute.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenSerializationAttribute.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenSuppressAttribute.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenTypeAttribute.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ErrorResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/PageableWrapper.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/RawRequestUriBuilderExtensions.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/RequestContextExtensions.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/SerializationFormat.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/TypeFormatters.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ActiveDirectoryConfigOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupPolicyOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupVaultOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BucketOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/CacheOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ClusterPeerCommandResponseOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ClusterPeerCommandResultOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticAccountOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupPolicyOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupVaultOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticCapacityPoolOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticSnapshotOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticSnapshotPolicyOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticVolumeOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetGroupIdListForLdapUserResponseOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetGroupIdListForLdapUserResultOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetKeyVaultStatusResponseOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ListQuotaReportResponseOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupPolicyOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupVaultBackupOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupVaultOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBucketOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppKeyVaultStatusResultOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppSubvolumeInfoOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppSubvolumeMetadataOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeGroupOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeQuotaReportListResultOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeQuotaRuleOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeSnapshotOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetworkSiblingSetOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SnapshotOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SubvolumeInfoOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SubvolumeModelOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SvmPeerCommandResponseOperationSource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SvmPeerCommandResultOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeGroupDetailsOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeQuotaRuleOperationSource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountEncryption.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountEncryption.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountProperties.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{NetAppAccountActiveDirectory.Serialization.cs => ActiveDirectory.Serialization.cs} (52%) rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{NetAppAccountActiveDirectory.cs => ActiveDirectory.cs} (69%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigListResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigListResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigPatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigPatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigUpdateProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigUpdateProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryStatus.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActualRansomwareProtectionState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AuthorizeRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AuthorizeRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvsDataStore.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatchProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatchProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyPatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyPatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupProperties.Serialization.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/{NetAppBackupData.cs => Models/BackupProperties.cs} (54%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupRestoreFiles.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupRestoreFiles.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultPatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultPatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultProperties.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationContent.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakFileLocksRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakFileLocksRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakReplicationRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakReplicationRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakthroughMode.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketCredentialsExpiry.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketCredentialsExpiry.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketGenerateCredentials.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketGenerateCredentials.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketList.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketList.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchPermissions.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPermissions.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerPatchProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerPatchProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheLifeCycleState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheList.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheList.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheMountTargetProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheMountTargetProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CachePatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CachePatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProvisioningState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheUpdateProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheUpdateProperties.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolQosType.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeKeyVault.Serialization.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{NetAppChangeKeyVault.cs => ChangeKeyVault.cs} (53%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeZoneRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeZoneRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckAvailabilityResponse.Serialization.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{NetAppCheckAvailabilityResult.cs => CheckAvailabilityResponse.cs} (50%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityReason.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityStatus.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticVolumeFilePathAvailabilityRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticVolumeFilePathAvailabilityRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckNameResourceTypes.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckQuotaNameResourceTypes.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChownMode.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsChangeNotifyState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResponse.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResponse.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResult.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CredentialsStatus.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DailySchedule.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DailySchedule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DayOfWeek.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DesiredRansomwareProtectionState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DestinationReplication.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DestinationReplication.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Dimension.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Dimension.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountListResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountListResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountPatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountPatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountUpdateProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountUpdateProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupListResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupListResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyListResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyListResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupType.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultListResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultListResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolListResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolListResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolPatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolPatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolUpdateProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolUpdateProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryption.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryption.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionConfiguration.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionConfiguration.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionIdentity.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionIdentity.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicy.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicy.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicyRule.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicyRule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultStatus.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticMountTargetProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticMountTargetProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticNfsv3Access.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticNfsv4Access.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticPoolEncryptionKeySource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticProtocolType.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticResourceAvailabilityStatus.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticRootAccess.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticServiceLevel.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbEncryption.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbPatchProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbPatchProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotListResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotListResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyDailySchedule.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyDailySchedule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyHourlySchedule.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyHourlySchedule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyListResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyListResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyMonthlySchedule.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyMonthlySchedule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyVolumeList.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyVolumeList.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyWeeklySchedule.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyWeeklySchedule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticUnixAccessRule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeBackupProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeBackupProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionPatchProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionPatchProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeListResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeListResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePolicyEnforcement.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRestorationState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRevert.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRevert.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeSnapshotProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeSnapshotProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeUpdateProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeUpdateProperties.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableNetAppSubvolume.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableSubvolumes.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableWriteBackState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionIdentity.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionIdentity.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionKeySource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionTransitionRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionTransitionRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Exclude.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExportPolicyRule.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExportPolicyRule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileAccessLogs.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FilePathAvailabilityRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FilePathAvailabilityRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileSystemUser.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileSystemUser.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserContent.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResponse.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResponse.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResult.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponse.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponse.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponseProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponseProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GlobalFileLockingState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/HourlySchedule.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/HourlySchedule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/InAvailabilityReasonType.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KerberosState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeySource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultPrivateEndpoint.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultPrivateEndpoint.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LargeVolumeType.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapSearchScopeOpt.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapSearchScopeOpt.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListQuotaReportResponse.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListQuotaReportResponse.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplicationsRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplicationsRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LogSpecification.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LogSpecification.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricAggregationType.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricSpecification.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricSpecification.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MonthlySchedule.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MonthlySchedule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MountTargetProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MountTargetProperties.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountActiveDirectoryStatus.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountEncryption.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountEncryption.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAvsDataStore.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupPolicyPatch.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupPolicyPatch.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultBackupPatch.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultBackupPatch.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultPatch.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultPatch.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialStatus.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialsExpiry.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialsExpiry.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketFileSystemUser.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketFileSystemUser.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketGenerateCredentials.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketGenerateCredentials.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketList.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketList.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketNfsUser.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketNfsUser.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatch.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatch.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatchPermission.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPermission.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerPatchProperties.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerPatchProperties.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerProperties.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerProperties.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChangeKeyVault.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppCheckAvailabilityResult.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChownMode.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppDestinationReplication.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppDestinationReplication.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionIdentity.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionIdentity.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionKeySource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionTransitionContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionTransitionContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFileAccessLog.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFilePathAvailabilityContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFilePathAvailabilityContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeySource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultPrivateEndpoint.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultPrivateEndpoint.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultProperties.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultProperties.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatusResult.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatusResult.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppLdapSearchScopeConfiguration.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppLdapSearchScopeConfiguration.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityResourceType.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameUnavailableReason.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNetworkFeature.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppProvisioningState.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppProvisioningState.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityResourceType.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRegionInfo.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRegionInfo.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRelationshipStatus.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationSchedule.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationType.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubscriptionQuotaItem.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubscriptionQuotaItem.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeInfoPatch.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeInfoPatch.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeMetadata.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeMetadata.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageName.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageName.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageResult.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageResult.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeAuthorizeReplicationContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeAuthorizeReplicationContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupBackupRestoreFilesContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupBackupRestoreFilesContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupConfiguration.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupConfiguration.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupDetail.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupDetail.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakFileLocksContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakFileLocksContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakReplicationContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakReplicationContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeDataProtection.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeDataProtection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupMetadata.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupMetadata.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupResult.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupResult.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupVolume.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeLanguage.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeMountTarget.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeMountTarget.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatch.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatchDataProtection.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatchDataProtection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePoolChangeContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePoolChangeContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReport.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReportListResult.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReportListResult.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaRulePatch.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaRulePatch.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaType.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReestablishReplicationContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReestablishReplicationContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRelocationProperties.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRelocationProperties.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplication.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplication.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplicationStatus.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplicationStatus.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRevertContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRevertContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSecurityStyle.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSnapshotRestoreFilesContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSnapshotRestoreFilesContent.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeStorageToNetworkProximity.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkFeatures.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NfsUser.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NfsUser.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Operation.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Operation.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationDisplay.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationListResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationListResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OriginClusterInformation.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OriginClusterInformation.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationContent.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeeringPassphrases.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeeringPassphrases.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PolicyState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PolicyStatus.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolChangeRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolChangeRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolPatchProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolPatchProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ProtocolTypes.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QosType.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetContent.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetRequest.Serialization.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{QueryNetworkSiblingSetContent.cs => QueryNetworkSiblingSetRequest.cs} (53%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaAvailabilityRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaAvailabilityRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaReport.Serialization.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{NetAppVolumeQuotaReport.cs => QuotaReport.cs} (52%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionPatchSettings.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionPatchSettings.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionSettings.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionSettings.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportSeverity.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportsList.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportsList.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectResolution.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspects.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspects.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectsClearRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectsClearRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReestablishReplicationRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReestablishReplicationRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfo.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfo.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfosList.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfosList.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeContent.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeContent.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Replication.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Replication.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationMirrorState.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{NetAppReplicationObject.Serialization.cs => ReplicationObject.Serialization.cs} (50%) rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{NetAppReplicationObject.cs => ReplicationObject.cs} (57%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationSchedule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationStatus.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationStatus.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationType.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ResourceNameAvailabilityRequest.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ResourceNameAvailabilityRequest.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPassword.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPassword.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordIdentity.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordIdentity.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordKeyVaultProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordKeyVaultProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecurityStyle.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ServiceSpecification.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ServiceSpecification.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbEncryptionState.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbSettings.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbSettings.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotDirectoryVisibility.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPatch.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyDailySchedule.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyDailySchedule.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyHourlySchedule.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyHourlySchedule.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyMonthlySchedule.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyMonthlySchedule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyProperties.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyWeeklySchedule.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyWeeklySchedule.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotRestoreFiles.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotRestoreFiles.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotUsage.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeInfoPatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeInfoPatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModel.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModel.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModelProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModelProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumePatchParams.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumePatchParams.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SuspectFile.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SuspectFile.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResponse.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResponse.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResult.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Type.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetContent.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetRequest.Serialization.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{UpdateNetworkSiblingSetContent.cs => UpdateNetworkSiblingSetRequest.cs} (61%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageName.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageName.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageResult.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageResult.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupRelationshipStatus.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackups.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackups.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroup.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroup.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupListProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupListProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupMetaData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupMetaData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeLanguage.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchProperties.Serialization.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{NetAppVolumePatch.cs => VolumePatchProperties.cs} (56%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesDataProtection.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesDataProtection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeProperties.Serialization.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/{NetAppVolumeGroupVolume.cs => VolumeProperties.cs} (64%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesDataProtection.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesDataProtection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesExportPolicy.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesExportPolicy.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulePatch.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulePatch.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRelocationProperties.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRelocationProperties.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRestoreRelationshipStatus.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRevert.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRevert.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSize.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeStorageToNetworkProximity.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/WeeklySchedule.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/WeeklySchedule.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupData.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyCollection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyData.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyData.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupCollection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupResource.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupResource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultCollection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultData.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultData.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultResource.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultResource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketCollection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketData.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketData.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketResource.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsAccountGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsAccountGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceUsagesGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceUsagesGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemResource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoCollection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoData.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoData.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeCollection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeData.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeData.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupCollection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupData.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupData.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleCollection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleData.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleData.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotCollection.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotData.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotData.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.Serialization.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/OperationsGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/OperationsGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/PoolsGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/PoolsGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportsGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportsGetAllCollectionResultOfT.cs delete mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ActiveDirectoryConfigsRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/CachesRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticAccountsRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupPoliciesRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupVaultsRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupsRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticCapacityPoolsRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticSnapshotPoliciesRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticSnapshotsRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticVolumesRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/OperationsRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/RansomwareReportsRestOperations.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPoliciesGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPoliciesGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotsGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotsGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumesGetByVolumeAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumesGetByVolumeCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupsGetByNetAppAccountAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupsGetByNetAppAccountCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleCollection.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleData.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleData.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRulesGetByVolumeAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRulesGetByVolumeCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeResource.Serialization.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeResource.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetAllAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetAllCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetReplicationsAsyncCollectionResultOfT.cs create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetReplicationsCollectionResultOfT.cs rename sdk/netapp/Azure.ResourceManager.NetApp/src/{autorest.md => autorest.md.bak} (96%) create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/tsp-location.yaml create mode 100644 sdk/netapp/Azure.ResourceManager.NetApp/tsp_client_metadata.yaml diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/ApiCompatBaseline.txt b/sdk/netapp/Azure.ResourceManager.NetApp/src/ApiCompatBaseline.txt deleted file mode 100644 index cd874c37b840..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/ApiCompatBaseline.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Baselining these as they are not actual compat issues. -CannotRemoveAttribute : Attribute 'System.ComponentModel.EditorBrowsableAttribute' exists on 'Azure.ResourceManager.NetApp.Models.NetAppVolumeBackupConfiguration..ctor()' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.ComponentModel.EditorBrowsableAttribute' exists on 'Azure.ResourceManager.NetApp.Models.NetAppVolumeBackupConfiguration.BackupPolicyId' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.ComponentModel.EditorBrowsableAttribute' exists on 'Azure.ResourceManager.NetApp.Models.NetAppVolumeBackupStatus' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.ComponentModel.EditorBrowsableAttribute' exists on 'Azure.ResourceManager.NetApp.Models.NetAppVolumeDataProtection.Backup' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.ComponentModel.EditorBrowsableAttribute' exists on 'Azure.ResourceManager.NetApp.Models.NetAppVolumePatchDataProtection.Backup' in the contract but not the implementation. -CannotRemoveAttribute : Attribute 'System.ComponentModel.EditorBrowsableAttribute' exists on 'Azure.ResourceManager.NetApp.Models.NetAppVolumePatch.DataProtection' in the contract but not the implementation. diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..11ad027da0b4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class AccountsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Accounts _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of AccountsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Accounts client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public AccountsGetAllAsyncCollectionResultOfT(Accounts client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of AccountsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of AccountsGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + NetAppAccountList result = NetAppAccountList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("NetAppAccountCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..ed875f6d1fdb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetAllCollectionResultOfT.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class AccountsGetAllCollectionResultOfT : Pageable + { + private readonly Accounts _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of AccountsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Accounts client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public AccountsGetAllCollectionResultOfT(Accounts client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of AccountsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of AccountsGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + NetAppAccountList result = NetAppAccountList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("NetAppAccountCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..451936848883 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetBySubscriptionAsyncCollectionResultOfT.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class AccountsGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly Accounts _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of AccountsGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Accounts client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public AccountsGetBySubscriptionAsyncCollectionResultOfT(Accounts client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of AccountsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of AccountsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + NetAppAccountList result = NetAppAccountList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetNetAppAccounts"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetBySubscriptionCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..8ba26d09c259 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/AccountsGetBySubscriptionCollectionResultOfT.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class AccountsGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly Accounts _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of AccountsGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Accounts client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public AccountsGetBySubscriptionCollectionResultOfT(Accounts client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of AccountsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of AccountsGetBySubscriptionCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + NetAppAccountList result = NetAppAccountList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetNetAppAccounts"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigCollection.cs new file mode 100644 index 000000000000..b23a9db28abb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigCollection.cs @@ -0,0 +1,548 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetActiveDirectoryConfigs method from an instance of the parent resource. + /// + public partial class ActiveDirectoryConfigCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _activeDirectoryConfigsClientDiagnostics; + private readonly ActiveDirectoryConfigs _activeDirectoryConfigsRestClient; + + /// Initializes a new instance of ActiveDirectoryConfigCollection for mocking. + protected ActiveDirectoryConfigCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ActiveDirectoryConfigCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ActiveDirectoryConfigResource.ResourceType, out string activeDirectoryConfigApiVersion); + _activeDirectoryConfigsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ActiveDirectoryConfigResource.ResourceType.Namespace, Diagnostics); + _activeDirectoryConfigsRestClient = new ActiveDirectoryConfigs(_activeDirectoryConfigsClientDiagnostics, Pipeline, Endpoint, activeDirectoryConfigApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } + } + + /// + /// Create or update the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the NetAppAccount. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string activeDirectoryConfigName, ActiveDirectoryConfigData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activeDirectoryConfigName, nameof(activeDirectoryConfigName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, activeDirectoryConfigName, ActiveDirectoryConfigData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ActiveDirectoryConfigOperationSource(Client), + _activeDirectoryConfigsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the NetAppAccount. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string activeDirectoryConfigName, ActiveDirectoryConfigData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activeDirectoryConfigName, nameof(activeDirectoryConfigName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, activeDirectoryConfigName, ActiveDirectoryConfigData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ActiveDirectoryConfigOperationSource(Client), + _activeDirectoryConfigsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the NetAppAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string activeDirectoryConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activeDirectoryConfigName, nameof(activeDirectoryConfigName)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, activeDirectoryConfigName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the NetAppAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string activeDirectoryConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activeDirectoryConfigName, nameof(activeDirectoryConfigName)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, activeDirectoryConfigName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all active directory configurations within the resource group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ActiveDirectoryConfigsGetByResourceGroupAsyncCollectionResultOfT(_activeDirectoryConfigsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new ActiveDirectoryConfigResource(Client, data)); + } + + /// List all active directory configurations within the resource group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ActiveDirectoryConfigsGetByResourceGroupCollectionResultOfT(_activeDirectoryConfigsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new ActiveDirectoryConfigResource(Client, data)); + } + + /// + /// Get the details of the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the NetAppAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string activeDirectoryConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activeDirectoryConfigName, nameof(activeDirectoryConfigName)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, activeDirectoryConfigName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ActiveDirectoryConfigData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the NetAppAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string activeDirectoryConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activeDirectoryConfigName, nameof(activeDirectoryConfigName)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, activeDirectoryConfigName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ActiveDirectoryConfigData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the NetAppAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string activeDirectoryConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activeDirectoryConfigName, nameof(activeDirectoryConfigName)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, activeDirectoryConfigName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ActiveDirectoryConfigData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the NetAppAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string activeDirectoryConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activeDirectoryConfigName, nameof(activeDirectoryConfigName)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, activeDirectoryConfigName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ActiveDirectoryConfigData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigData.Serialization.cs new file mode 100644 index 000000000000..b4a18a75c46b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigData.Serialization.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Active Directory Configuration resource. + public partial class ActiveDirectoryConfigData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ActiveDirectoryConfigData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryConfigData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + ((IJsonModel)Identity).Write(writer, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ActiveDirectoryConfigData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ActiveDirectoryConfigData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryConfigData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeActiveDirectoryConfigData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ActiveDirectoryConfigData DeserializeActiveDirectoryConfigData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + ActiveDirectoryConfigProperties properties = default; + string eTag = default; + ManagedServiceIdentity identity = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ActiveDirectoryConfigProperties.DeserializeActiveDirectoryConfigProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("etag"u8)) + { + eTag = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("identity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ActiveDirectoryConfigData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + eTag, + identity); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ActiveDirectoryConfigData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ActiveDirectoryConfigData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ActiveDirectoryConfigData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeActiveDirectoryConfigData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ActiveDirectoryConfigData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ActiveDirectoryConfigData activeDirectoryConfigData) + { + if (activeDirectoryConfigData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(activeDirectoryConfigData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ActiveDirectoryConfigData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeActiveDirectoryConfigData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigData.cs new file mode 100644 index 000000000000..e1cfb36d9e6c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigData.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Active Directory Configuration resource. + public partial class ActiveDirectoryConfigData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public ActiveDirectoryConfigData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + /// The managed service identities assigned to this resource. + internal ActiveDirectoryConfigData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, ActiveDirectoryConfigProperties properties, string eTag, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; + Identity = identity; + } + + /// The resource-specific properties for this resource. + public ActiveDirectoryConfigProperties Properties { get; set; } + + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + public string ETag { get; } + + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigResource.Serialization.cs new file mode 100644 index 000000000000..e450e08eea09 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class ActiveDirectoryConfigResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ActiveDirectoryConfigData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ActiveDirectoryConfigData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + ActiveDirectoryConfigData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigResource.cs new file mode 100644 index 000000000000..9d64068e3f6d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigResource.cs @@ -0,0 +1,682 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a ActiveDirectoryConfig along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetActiveDirectoryConfigs method. + /// + public partial class ActiveDirectoryConfigResource : ArmResource + { + private readonly ClientDiagnostics _activeDirectoryConfigsClientDiagnostics; + private readonly ActiveDirectoryConfigs _activeDirectoryConfigsRestClient; + private readonly ActiveDirectoryConfigData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/activeDirectoryConfigs"; + + /// Initializes a new instance of ActiveDirectoryConfigResource for mocking. + protected ActiveDirectoryConfigResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ActiveDirectoryConfigResource(ArmClient client, ActiveDirectoryConfigData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ActiveDirectoryConfigResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string activeDirectoryConfigApiVersion); + _activeDirectoryConfigsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _activeDirectoryConfigsRestClient = new ActiveDirectoryConfigs(_activeDirectoryConfigsClientDiagnostics, Pipeline, Endpoint, activeDirectoryConfigApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual ActiveDirectoryConfigData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The activeDirectoryConfigName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string activeDirectoryConfigName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the details of the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ActiveDirectoryConfigPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, ActiveDirectoryConfigPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ActiveDirectoryConfigOperationSource(Client), + _activeDirectoryConfigsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ActiveDirectoryConfigPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, ActiveDirectoryConfigPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ActiveDirectoryConfigOperationSource(Client), + _activeDirectoryConfigsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified Active Directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_activeDirectoryConfigsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified Active Directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_activeDirectoryConfigsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ActiveDirectoryConfigData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ActiveDirectoryConfigPatch patch = new ActiveDirectoryConfigPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ActiveDirectoryConfigData current = Get(cancellationToken: cancellationToken).Value.Data; + ActiveDirectoryConfigPatch patch = new ActiveDirectoryConfigPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ActiveDirectoryConfigData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ActiveDirectoryConfigPatch patch = new ActiveDirectoryConfigPatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ActiveDirectoryConfigData current = Get(cancellationToken: cancellationToken).Value.Data; + ActiveDirectoryConfigPatch patch = new ActiveDirectoryConfigPatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ActiveDirectoryConfigData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ActiveDirectoryConfigPatch patch = new ActiveDirectoryConfigPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _activeDirectoryConfigsClientDiagnostics.CreateScope("ActiveDirectoryConfigResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _activeDirectoryConfigsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ActiveDirectoryConfigData.FromResponse(result), result); + return Response.FromValue(new ActiveDirectoryConfigResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ActiveDirectoryConfigData current = Get(cancellationToken: cancellationToken).Value.Data; + ActiveDirectoryConfigPatch patch = new ActiveDirectoryConfigPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..924cb14422cf --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetByResourceGroupAsyncCollectionResultOfT.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ActiveDirectoryConfigsGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly ActiveDirectoryConfigs _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of ActiveDirectoryConfigsGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ActiveDirectoryConfigs client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public ActiveDirectoryConfigsGetByResourceGroupAsyncCollectionResultOfT(ActiveDirectoryConfigs client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of ActiveDirectoryConfigsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ActiveDirectoryConfigsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ActiveDirectoryConfigListResult result = ActiveDirectoryConfigListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ActiveDirectoryConfigCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetByResourceGroupCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..de3152d125d3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetByResourceGroupCollectionResultOfT.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ActiveDirectoryConfigsGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly ActiveDirectoryConfigs _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of ActiveDirectoryConfigsGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ActiveDirectoryConfigs client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public ActiveDirectoryConfigsGetByResourceGroupCollectionResultOfT(ActiveDirectoryConfigs client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of ActiveDirectoryConfigsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ActiveDirectoryConfigsGetByResourceGroupCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ActiveDirectoryConfigListResult result = ActiveDirectoryConfigListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ActiveDirectoryConfigCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..9348ef7db141 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetBySubscriptionAsyncCollectionResultOfT.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ActiveDirectoryConfigsGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly ActiveDirectoryConfigs _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of ActiveDirectoryConfigsGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ActiveDirectoryConfigs client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ActiveDirectoryConfigsGetBySubscriptionAsyncCollectionResultOfT(ActiveDirectoryConfigs client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of ActiveDirectoryConfigsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ActiveDirectoryConfigsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ActiveDirectoryConfigListResult result = ActiveDirectoryConfigListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetActiveDirectoryConfigs"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetBySubscriptionCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..e44673be8c2c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ActiveDirectoryConfigsGetBySubscriptionCollectionResultOfT.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ActiveDirectoryConfigsGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly ActiveDirectoryConfigs _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of ActiveDirectoryConfigsGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ActiveDirectoryConfigs client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ActiveDirectoryConfigsGetBySubscriptionCollectionResultOfT(ActiveDirectoryConfigs client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of ActiveDirectoryConfigsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ActiveDirectoryConfigsGetBySubscriptionCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ActiveDirectoryConfigListResult result = ActiveDirectoryConfigListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetActiveDirectoryConfigs"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ArmNetAppModelFactory.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ArmNetAppModelFactory.cs index 2658d7b7a4dd..cc90ebb33b01 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ArmNetAppModelFactory.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ArmNetAppModelFactory.cs @@ -7,432 +7,187 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; using System.Net; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - /// Model factory for models. + /// A factory class for creating instances of the models for mocking. public static partial class ArmNetAppModelFactory { - /// Initializes a new instance of . - /// <code>true</code> indicates name is valid and available. <code>false</code> indicates the name is invalid, unavailable, or both. - /// <code>Invalid</code> indicates the name provided does not match Azure App Service naming requirements. <code>AlreadyExists</code> indicates that the name is already in use and is therefore unavailable. - /// If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. - /// A new instance for mocking. - public static NetAppCheckAvailabilityResult NetAppCheckAvailabilityResult(bool? isAvailable = null, NetAppNameUnavailableReason? reason = null, string message = null) - { - return new NetAppCheckAvailabilityResult(isAvailable, reason, message, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// File path to verify. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// The Azure Resource logical availability zone which is used within zone mapping lookup for the subscription and region. The lookup will retrieve the physical zone where volume is placed. - /// A new instance for mocking. - public static NetAppFilePathAvailabilityContent NetAppFilePathAvailabilityContent(string name = null, ResourceIdentifier subnetId = null, string availabilityZone = null) - { - return new NetAppFilePathAvailabilityContent(name, subnetId, availabilityZone, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . - /// The id of the usage. - /// The name of the usage. - /// The current usage value for the subscription. - /// The limit of the usage. - /// The unit of the usage. - /// A new instance for mocking. - public static NetAppUsageResult NetAppUsageResult(string id = null, NetAppUsageName name = null, int? currentValue = null, int? limit = null, string unit = null) - { - return new NetAppUsageResult( - id, + /// Operation name: {provider}/{resource}/{operation}. + /// Display metadata associated with the operation. + /// The origin of operations. + /// One property of operation, include metric specifications. + /// A new instance for mocking. + public static Operation Operation(string name = default, OperationDisplay display = default, string origin = default, ServiceSpecification serviceSpecification = default) + { + return new Operation(name, display, origin, serviceSpecification is null ? default : new OperationProperties(serviceSpecification, new Dictionary()), additionalBinaryDataProperties: null); + } + + /// Display metadata associated with the operation. + /// Service provider: Microsoft NetApp. + /// Resource on which the operation is performed etc. + /// Type of operation: get, read, delete, etc. + /// Operation description. + /// A new instance for mocking. + public static OperationDisplay OperationDisplay(string provider = default, string resource = default, string operation = default, string description = default) + { + return new OperationDisplay(provider, resource, operation, description, additionalBinaryDataProperties: null); + } + + /// One property of operation, include metric specifications. + /// Metric specifications of operation. + /// Log specification of operation. + /// A new instance for mocking. + public static ServiceSpecification ServiceSpecification(IEnumerable metricSpecifications = default, IEnumerable logSpecifications = default) + { + metricSpecifications ??= new ChangeTrackingList(); + logSpecifications ??= new ChangeTrackingList(); + + return new ServiceSpecification(metricSpecifications.ToList(), logSpecifications.ToList(), additionalBinaryDataProperties: null); + } + + /// Metric specification of operation. + /// Name of metric specification. + /// Display name of metric specification. + /// Display description of metric specification. + /// Unit could be Bytes or Count. + /// Support metric aggregation type. + /// The supported time grain types for the metrics. + /// The internal metric name. + /// Whether or not the service is using regional MDM accounts. + /// The source MDM account. + /// The source MDM namespace. + /// Dimensions of blobs, including blob type and access tier. + /// Aggregation type could be Average. + /// The property to decide fill gap with zero or not. + /// The category this metric specification belong to, could be Capacity. + /// Account Resource Id. + /// Whether the metric is internal. + /// A new instance for mocking. + public static MetricSpecification MetricSpecification(string name = default, string displayName = default, string displayDescription = default, string unit = default, IEnumerable supportedAggregationTypes = default, IEnumerable supportedTimeGrainTypes = default, string internalMetricName = default, bool? enableRegionalMdmAccount = default, string sourceMdmAccount = default, string sourceMdmNamespace = default, IEnumerable dimensions = default, string aggregationType = default, bool? fillGapWithZero = default, string category = default, string resourceIdDimensionNameOverride = default, bool? isInternal = default) + { + supportedAggregationTypes ??= new ChangeTrackingList(); + supportedTimeGrainTypes ??= new ChangeTrackingList(); + dimensions ??= new ChangeTrackingList(); + + return new MetricSpecification( name, - currentValue, - limit, + displayName, + displayDescription, unit, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the usage. - /// The localized name of the usage. - /// A new instance for mocking. - public static NetAppUsageName NetAppUsageName(string value = null, string localizedValue = null) - { - return new NetAppUsageName(value, localizedValue, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + supportedAggregationTypes.ToList(), + supportedTimeGrainTypes.ToList(), + internalMetricName, + enableRegionalMdmAccount, + sourceMdmAccount, + sourceMdmNamespace, + dimensions.ToList(), + aggregationType, + fillGapWithZero, + category, + resourceIdDimensionNameOverride, + isInternal, + additionalBinaryDataProperties: null); + } + + /// Dimension of blobs, possibly be blob type or access tier. + /// Display name of dimension. + /// Display name of dimension. + /// A new instance for mocking. + public static Dimension Dimension(string name = default, string displayName = default) + { + return new Dimension(name, displayName, additionalBinaryDataProperties: null); + } + + /// Log Definition of a single resource metric. + /// Name of log specification. + /// Display name of log specification. + /// A new instance for mocking. + public static LogSpecification LogSpecification(string name = default, string displayName = default) + { + return new LogSpecification(name, displayName, additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// The current quota value. /// The default quota value. /// The usage quota value. - /// A new instance for mocking. - public static NetAppSubscriptionQuotaItem NetAppSubscriptionQuotaItem(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, int? current = null, int? @default = null, int? usage = null) - { - return new NetAppSubscriptionQuotaItem( - id, - name, - resourceType, - systemData, - current, - @default, - usage, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Provides storage to network proximity information in the region. - /// Provides logical availability zone mappings for the subscription for a region. - /// A new instance for mocking. - public static NetAppRegionInfo NetAppRegionInfo(RegionStorageToNetworkProximity? storageToNetworkProximity = null, IEnumerable availabilityZoneMappings = null) - { - availabilityZoneMappings ??= new List(); - - return new NetAppRegionInfo(storageToNetworkProximity, availabilityZoneMappings?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Provides storage to network proximity information in the region. - /// Provides logical availability zone mappings for the subscription for a region. - /// A new instance for mocking. - public static RegionInfoResourceData RegionInfoResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, RegionStorageToNetworkProximity? storageToNetworkProximity = null, IEnumerable availabilityZoneMappings = null) - { - availabilityZoneMappings ??= new List(); - - return new RegionInfoResourceData( - id, - name, - resourceType, - systemData, - storageToNetworkProximity, - availabilityZoneMappings?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. - /// Network sibling set state Id identifying the current state of the sibling set. - /// Network features available to the volume, or current state of update. - /// Gets the status of the NetworkSiblingSet at the time the operation was called. - /// List of NIC information. - /// A new instance for mocking. - public static NetworkSiblingSet NetworkSiblingSet(string networkSiblingSetId = null, ResourceIdentifier subnetId = null, string networkSiblingSetStateId = null, NetAppNetworkFeature? networkFeatures = null, NetworkSiblingSetProvisioningState? provisioningState = null, IEnumerable nicInfoList = null) - { - nicInfoList ??= new List(); - - return new NetworkSiblingSet( - networkSiblingSetId, - subnetId, - networkSiblingSetStateId, - networkFeatures, - provisioningState, - nicInfoList?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// ipAddress. - /// Volume resource Ids. - /// A new instance for mocking. - public static NicInfo NicInfo(string ipAddress = null, IEnumerable volumeResourceIds = null) - { - volumeResourceIds ??= new List(); - - return new NicInfo(ipAddress, volumeResourceIds?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// The identity used for the resource. - /// Azure lifecycle management. - /// Active Directories. - /// Encryption settings. - /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. - /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. - /// MultiAD Status for the account. - /// LDAP Configuration for the account. - /// A new instance for mocking. - public static NetAppAccountData NetAppAccountData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, ManagedServiceIdentity identity = null, string provisioningState = null, IEnumerable activeDirectories = null, NetAppAccountEncryption encryption = null, bool? disableShowmount = null, string nfsV4IdDomain = null, MultiAdStatus? multiAdStatus = null, LdapConfiguration ldapConfiguration = null) + /// A new instance for mocking. + public static NetAppSubscriptionQuotaItemData NetAppSubscriptionQuotaItemData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, int? current = default, int? @default = default, int? usage = default) { - tags ??= new Dictionary(); - activeDirectories ??= new List(); - - return new NetAppAccountData( + return new NetAppSubscriptionQuotaItemData( id, name, resourceType, systemData, - tags, - location, - etag, - identity, - provisioningState, - activeDirectories?.ToList(), - encryption, - disableShowmount, - nfsV4IdDomain, - multiAdStatus, - ldapConfiguration, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Id of the Active Directory. - /// A domain user account with permission to create machine accounts. - /// Plain text password of Active Directory domain administrator, value is masked in the response. - /// Name of the Active Directory domain. - /// Comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory domain. - /// Status of the Active Directory. - /// Any details in regards to the Status of the Active Directory. - /// NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. - /// The Organizational Unit (OU) within the Windows Active Directory. - /// The Active Directory site the service will limit Domain Controller discovery to. - /// Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier. - /// Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier. - /// kdc server IP address for the active directory machine. This optional parameter is used only while creating kerberos volume. - /// Name of the active directory machine. This optional parameter is used only while creating kerberos volume. - /// When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded Active Directory Certificate Service's self-signed root CA certificate, this optional parameter is used only for dual protocol with LDAP user-mapping volumes. - /// If enabled, AES encryption will be enabled for SMB communication. - /// Specifies whether or not the LDAP traffic needs to be signed. - /// Domain Users in the Active directory to be given SeSecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. - /// Specifies whether or not the LDAP traffic needs to be secured via TLS. - /// If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes. - /// If enabled, Traffic between the SMB server to Domain Controller (DC) will be encrypted. - /// LDAP Search scope options. - /// Comma separated list of IPv4 addresses of preferred servers for LDAP client. At most two comma separated IPv4 addresses can be passed. - /// A new instance for mocking. - public static NetAppAccountActiveDirectory NetAppAccountActiveDirectory(string activeDirectoryId = null, string username = null, string password = null, string domain = null, string dns = null, NetAppAccountActiveDirectoryStatus? status = null, string statusDetails = null, string smbServerName = null, string organizationalUnit = null, string site = null, IEnumerable backupOperators = null, IEnumerable administrators = null, IPAddress kdcIP = null, string adName = null, string serverRootCACertificate = null, bool? isAesEncryptionEnabled = null, bool? isLdapSigningEnabled = null, IEnumerable securityOperators = null, bool? isLdapOverTlsEnabled = null, bool? allowLocalNfsUsersWithLdap = null, bool? encryptDCConnections = null, NetAppLdapSearchScopeConfiguration ldapSearchScope = null, string preferredServersForLdapClient = null) - { - backupOperators ??= new List(); - administrators ??= new List(); - securityOperators ??= new List(); - - return new NetAppAccountActiveDirectory( - activeDirectoryId, - username, - password, - domain, - dns, - status, - statusDetails, - smbServerName, - organizationalUnit, - site, - backupOperators?.ToList(), - administrators?.ToList(), - kdcIP, - adName, - serverRootCACertificate, - isAesEncryptionEnabled, - isLdapSigningEnabled, - securityOperators?.ToList(), - isLdapOverTlsEnabled, - allowLocalNfsUsersWithLdap, - encryptDCConnections, - ldapSearchScope, - preferredServersForLdapClient, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// UUID v4 used to identify the Azure Key Vault configuration. - /// The Uri of KeyVault. - /// The name of KeyVault key. - /// The resource ID of KeyVault. - /// Status of the KeyVault connection. - /// A new instance for mocking. - public static NetAppKeyVaultProperties NetAppKeyVaultProperties(string keyVaultId = null, Uri keyVaultUri = null, string keyName = null, ResourceIdentifier keyVaultArmResourceId = null, NetAppKeyVaultStatus? status = null) - { - return new NetAppKeyVaultProperties( - keyVaultId, - keyVaultUri, - keyName, - keyVaultArmResourceId, - status, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. - /// The ARM resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. - /// ClientId of the multi-tenant AAD Application. Used to access cross-tenant KeyVaults. - /// A new instance for mocking. - public static NetAppEncryptionIdentity NetAppEncryptionIdentity(string principalId = null, string userAssignedIdentity = null, string federatedClientId = null) - { - return new NetAppEncryptionIdentity(principalId, userAssignedIdentity, federatedClientId, serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + current is null || @default is null || usage is null ? default : new QuotaItemProperties(current, @default, usage, new Dictionary())); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The identity used for the resource. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// Azure lifecycle management. - /// Active Directories. - /// Encryption settings. - /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. - /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. - /// MultiAD Status for the account. - /// LDAP Configuration for the account. - /// A new instance for mocking. - public static NetAppAccountPatch NetAppAccountPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, string provisioningState = null, IEnumerable activeDirectories = null, NetAppAccountEncryption encryption = null, bool? disableShowmount = null, string nfsV4IdDomain = null, MultiAdStatus? multiAdStatus = null, LdapConfiguration ldapConfiguration = null) + /// Volume group details. + /// List of volumes from group. + /// Resource location. + /// A new instance for mocking. + public static VolumeGroupDetailsData VolumeGroupDetailsData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, string provisioningState = default, VolumeGroupMetaData groupMetaData = default, IList volumes = default, string location = default) { - tags ??= new Dictionary(); - activeDirectories ??= new List(); - - return new NetAppAccountPatch( + return new VolumeGroupDetailsData( id, name, resourceType, systemData, - tags, - location, - identity, - provisioningState, - activeDirectories?.ToList(), - encryption, - disableShowmount, - nfsV4IdDomain, - multiAdStatus, - ldapConfiguration, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The URI of the key vault/managed HSM that should be used for encryption. - /// The name of the key that should be used for encryption. - /// Azure resource ID of the key vault/managed HSM that should be used for encryption. - /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. - /// A new instance for mocking. - public static NetAppKeyVaultStatusResult NetAppKeyVaultStatusResult(Uri keyVaultUri = null, string keyName = null, ResourceIdentifier keyVaultResourceId = null, IEnumerable keyVaultPrivateEndpoints = null) - { - keyVaultPrivateEndpoints ??= new List(); - - return new NetAppKeyVaultStatusResult(keyVaultUri, keyName, keyVaultResourceId, keyVaultPrivateEndpoints?.ToList(), serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + provisioningState is null || groupMetaData is null || volumes is null ? default : new VolumeGroupProperties(provisioningState, groupMetaData, volumes, new Dictionary()), + location); } - /// Initializes a new instance of . - /// The URI of the key vault/managed HSM that should be used for encryption. - /// The name of the key that should be used for encryption. - /// Azure resource ID of the key vault/managed HSM that should be used for encryption. - /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. - /// A new instance for mocking. - public static NetAppChangeKeyVault NetAppChangeKeyVault(Uri keyVaultUri = null, string keyName = null, ResourceIdentifier keyVaultResourceId = null, IEnumerable keyVaultPrivateEndpoints = null) + /// Volume group properties. + /// Group Description. + /// Application Type. + /// Application specific identifier. + /// Application specific placement rules for the volume group. + /// Number of volumes in volume group. + /// A new instance for mocking. + public static VolumeGroupMetaData VolumeGroupMetaData(string groupDescription = default, NetAppApplicationType? applicationType = default, string applicationIdentifier = default, IEnumerable globalPlacementRules = default, long? volumesCount = default) { - keyVaultPrivateEndpoints ??= new List(); + globalPlacementRules ??= new ChangeTrackingList(); - return new NetAppChangeKeyVault(keyVaultUri, keyName, keyVaultResourceId, keyVaultPrivateEndpoints?.ToList(), serializedAdditionalRawData: null); + return new VolumeGroupMetaData( + groupDescription, + applicationType, + applicationIdentifier, + globalPlacementRules.ToList(), + volumesCount, + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// UUID v4 used to identify the Pool. - /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). - /// The service level of the file system. - /// Azure lifecycle management. - /// Total throughput of pool in MiB/s. - /// Utilized throughput of pool in MiB/s. - /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. - /// The qos type of the pool. - /// If enabled (true) the pool can contain cool Access enabled volumes. - /// Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. - /// A new instance for mocking. - public static CapacityPoolData CapacityPoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, Guid? poolId = null, long size = default, NetAppFileServiceLevel serviceLevel = default, string provisioningState = null, float? totalThroughputMibps = null, float? utilizedThroughputMibps = null, float? customThroughputMibps = null, CapacityPoolQosType? qosType = null, bool? isCoolAccessEnabled = null, CapacityPoolEncryptionType? encryptionType = null) - { - tags ??= new Dictionary(); - - return new CapacityPoolData( - id, - name, - resourceType, - systemData, - tags, - location, - etag, - poolId, - size, - serviceLevel, - provisioningState, - totalThroughputMibps, - utilizedThroughputMibps, - customThroughputMibps, - qosType, - isCoolAccessEnabled, - encryptionType, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). - /// The qos type of the pool. - /// If enabled (true) the pool can contain cool Access enabled volumes. - /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. - /// A new instance for mocking. - public static CapacityPoolPatch CapacityPoolPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, long? size = null, CapacityPoolQosType? qosType = null, bool? isCoolAccessEnabled = null, float? customThroughputMibps = null) - { - tags ??= new Dictionary(); - - return new CapacityPoolPatch( - id, - name, - resourceType, - systemData, - tags, - location, - size, - qosType, - isCoolAccessEnabled, - customThroughputMibps, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. /// Availability Zone. /// Unique FileSystem Identifier. /// A unique file path for the volume. Used when creating mount targets. /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// /// Set of protocol types, default NFSv3, CIFS for SMB protocol. /// Azure lifecycle management. /// Resource identifier used to identify the Snapshot. @@ -449,29 +204,29 @@ public static CapacityPoolPatch CapacityPoolPatch(ResourceIdentifier id = null, /// DataProtection type volumes include an object containing details of the replication. /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. + /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). + /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. + /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. + /// Enables continuously available share property for smb volume. Only applicable for SMB volume. /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. + /// Specifies whether LDAP is enabled or not for a given NFS volume. /// Specifies the type of LDAP server for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. + /// Specifies whether Cool Access(tiering) is enabled for the volume. /// Specifies the number of days after which data that is not accessed by clients will be tiered. /// /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. /// /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. Avoid passing null value for unixPermissions in volume update operation, As per the behavior, If Null value is passed then user-visible unixPermissions value will became null, and user will not be able to get unixPermissions value. On safer side, actual unixPermissions value on volume will remain as its last saved value only. + /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. @@ -482,112 +237,115 @@ public static CapacityPoolPatch CapacityPoolPatch(ResourceIdentifier id = null, /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. /// Volume Group Name. /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. + /// Proximity placement group associated with the volume. /// T2 network information. /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. + /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. /// Application specific placement rules for the particular volume. /// Flag indicating whether subvolume operations are enabled on the volume. /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. /// Specifies whether volume is a Large Volume or Regular Volume. + /// + /// Specifies the type of the Large Volume. When set to 'LargeVolume', the large volume is created with standard configuration. + /// If it is set to 'ExtraLargeVolume7Dot2PiB', the extra large volume is created with higher capacity limit 7.2PiB with cool access enabled, + /// delivering higher capacity limit with lower costs. + /// /// Id of the snapshot or backup that the volume is restored from. /// Space shared by short term clone volume with parent volume in bytes. /// Language supported for volume. - /// A new instance for mocking. - public static NetAppVolumeData NetAppVolumeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, IEnumerable zones = null, Guid? fileSystemId = null, string creationToken = null, NetAppFileServiceLevel? serviceLevel = null, long usageThreshold = default, IEnumerable exportRules = null, IEnumerable protocolTypes = null, string provisioningState = null, string snapshotId = null, bool? deleteBaseSnapshot = null, string backupId = null, string baremetalTenantId = null, ResourceIdentifier subnetId = null, NetAppNetworkFeature? networkFeatures = null, NetAppNetworkFeature? effectiveNetworkFeatures = null, Guid? networkSiblingSetId = null, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity = null, IEnumerable mountTargets = null, string volumeType = null, NetAppVolumeDataProtection dataProtection = null, AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit = null, bool? isRestoring = null, bool? isSnapshotDirectoryVisible = null, bool? isKerberosEnabled = null, NetAppVolumeSecurityStyle? securityStyle = null, bool? isSmbEncryptionEnabled = null, SmbAccessBasedEnumeration? smbAccessBasedEnumeration = null, SmbNonBrowsable? smbNonBrowsable = null, bool? isSmbContinuouslyAvailable = null, float? throughputMibps = null, float? actualThroughputMibps = null, NetAppEncryptionKeySource? encryptionKeySource = null, ResourceIdentifier keyVaultPrivateEndpointResourceId = null, bool? isLdapEnabled = null, LdapServerType? ldapServerType = null, bool? isCoolAccessEnabled = null, int? coolnessPeriod = null, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = null, CoolAccessTieringPolicy? coolAccessTieringPolicy = null, string unixPermissions = null, int? cloneProgress = null, NetAppFileAccessLog? fileAccessLogs = null, NetAppAvsDataStore? avsDataStore = null, IEnumerable dataStoreResourceId = null, bool? isDefaultQuotaEnabled = null, long? defaultUserQuotaInKiBs = null, long? defaultGroupQuotaInKiBs = null, long? maximumNumberOfFiles = null, string volumeGroupName = null, ResourceIdentifier capacityPoolResourceId = null, ResourceIdentifier proximityPlacementGroupId = null, string t2Network = null, string volumeSpecName = null, bool? isEncrypted = null, IEnumerable placementRules = null, EnableNetAppSubvolume? enableSubvolumes = null, string provisionedAvailabilityZone = null, bool? isLargeVolume = null, ResourceIdentifier originatingResourceId = null, long? inheritedSizeInBytes = null, NetAppVolumeLanguage? language = null) - { - tags ??= new Dictionary(); - zones ??= new List(); - exportRules ??= new List(); - protocolTypes ??= new List(); - mountTargets ??= new List(); - dataStoreResourceId ??= new List(); - placementRules ??= new List(); - - return new NetAppVolumeData( + /// Specifies whether the volume operates in Breakthrough Mode. + /// Export policy rule. + /// A new instance for mocking. + public static VolumeGroupVolumeProperties VolumeGroupVolumeProperties(string id = default, string name = default, string @type = default, IDictionary tags = default, IEnumerable zones = default, string fileSystemId = default, string creationToken = default, NetAppFileServiceLevel? serviceLevel = default, long? usageThreshold = default, IList protocolTypes = default, string provisioningState = default, ResourceIdentifier snapshotId = default, bool? deleteBaseSnapshot = default, ResourceIdentifier backupId = default, string baremetalTenantId = default, string subnetId = default, NetworkFeatures? networkFeatures = default, NetworkFeatures? effectiveNetworkFeatures = default, string networkSiblingSetId = default, VolumeStorageToNetworkProximity? storageToNetworkProximity = default, IReadOnlyList mountTargets = default, string volumeType = default, VolumePropertiesDataProtection dataProtection = default, AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit = default, bool? isRestoring = default, bool? snapshotDirectoryVisible = default, bool? kerberosEnabled = default, SecurityStyle? securityStyle = default, bool? smbEncryption = default, SmbAccessBasedEnumeration? smbAccessBasedEnumeration = default, SmbNonBrowsable? smbNonBrowsable = default, bool? smbContinuouslyAvailable = default, float? throughputMibps = default, float? actualThroughputMibps = default, EncryptionKeySource? encryptionKeySource = default, string keyVaultPrivateEndpointResourceId = default, bool? ldapEnabled = default, LdapServerType? ldapServerType = default, bool? coolAccess = default, int? coolnessPeriod = default, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = default, CoolAccessTieringPolicy? coolAccessTieringPolicy = default, string unixPermissions = default, int? cloneProgress = default, FileAccessLogs? fileAccessLogs = default, AvsDataStore? avsDataStore = default, IReadOnlyList dataStoreResourceId = default, bool? isDefaultQuotaEnabled = default, long? defaultUserQuotaInKiBs = default, long? defaultGroupQuotaInKiBs = default, long? maximumNumberOfFiles = default, string volumeGroupName = default, string capacityPoolResourceId = default, string proximityPlacementGroup = default, string t2Network = default, string volumeSpecName = default, bool? encrypted = default, IList placementRules = default, EnableSubvolumes? enableSubvolumes = default, string provisionedAvailabilityZone = default, bool? isLargeVolume = default, LargeVolumeType? largeVolumeType = default, string originatingResourceId = default, long? inheritedSizeInBytes = default, VolumeLanguage? language = default, BreakthroughMode? breakthroughMode = default, IList exportRules = default) + { + tags ??= new ChangeTrackingDictionary(); + zones ??= new ChangeTrackingList(); + + return new VolumeGroupVolumeProperties( id, name, - resourceType, - systemData, + @type, tags, - location, - etag, - zones?.ToList(), - fileSystemId, - creationToken, - serviceLevel, - usageThreshold, - exportRules != null ? new VolumePropertiesExportPolicy(exportRules?.ToList(), serializedAdditionalRawData: null) : null, - protocolTypes?.ToList(), - provisioningState, - snapshotId, - deleteBaseSnapshot, - backupId, - baremetalTenantId, - subnetId, - networkFeatures, - effectiveNetworkFeatures, - networkSiblingSetId, - storageToNetworkProximity, - mountTargets?.ToList(), - volumeType, - dataProtection, - acceptGrowCapacityPoolForShortTermCloneSplit, - isRestoring, - isSnapshotDirectoryVisible, - isKerberosEnabled, - securityStyle, - isSmbEncryptionEnabled, - smbAccessBasedEnumeration, - smbNonBrowsable, - isSmbContinuouslyAvailable, - throughputMibps, - actualThroughputMibps, - encryptionKeySource, - keyVaultPrivateEndpointResourceId, - isLdapEnabled, - ldapServerType, - isCoolAccessEnabled, - coolnessPeriod, - coolAccessRetrievalPolicy, - coolAccessTieringPolicy, - unixPermissions, - cloneProgress, - fileAccessLogs, - avsDataStore, - dataStoreResourceId?.ToList(), - isDefaultQuotaEnabled, - defaultUserQuotaInKiBs, - defaultGroupQuotaInKiBs, - maximumNumberOfFiles, - volumeGroupName, - capacityPoolResourceId, - proximityPlacementGroupId, - t2Network, - volumeSpecName, - isEncrypted, - placementRules?.ToList(), - enableSubvolumes, - provisionedAvailabilityZone, - isLargeVolume, - originatingResourceId, - inheritedSizeInBytes, - language, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + zones.ToList(), + fileSystemId is null || creationToken is null || serviceLevel is null || usageThreshold is null || protocolTypes is null || provisioningState is null || snapshotId is null || deleteBaseSnapshot is null || backupId is null || baremetalTenantId is null || subnetId is null || networkFeatures is null || effectiveNetworkFeatures is null || networkSiblingSetId is null || storageToNetworkProximity is null || mountTargets is null || volumeType is null || dataProtection is null || acceptGrowCapacityPoolForShortTermCloneSplit is null || isRestoring is null || snapshotDirectoryVisible is null || kerberosEnabled is null || securityStyle is null || smbEncryption is null || smbAccessBasedEnumeration is null || smbNonBrowsable is null || smbContinuouslyAvailable is null || throughputMibps is null || actualThroughputMibps is null || encryptionKeySource is null || keyVaultPrivateEndpointResourceId is null || ldapEnabled is null || ldapServerType is null || coolAccess is null || coolnessPeriod is null || coolAccessRetrievalPolicy is null || coolAccessTieringPolicy is null || unixPermissions is null || cloneProgress is null || fileAccessLogs is null || avsDataStore is null || dataStoreResourceId is null || isDefaultQuotaEnabled is null || defaultUserQuotaInKiBs is null || defaultGroupQuotaInKiBs is null || maximumNumberOfFiles is null || volumeGroupName is null || capacityPoolResourceId is null || proximityPlacementGroup is null || t2Network is null || volumeSpecName is null || encrypted is null || placementRules is null || enableSubvolumes is null || provisionedAvailabilityZone is null || isLargeVolume is null || largeVolumeType is null || originatingResourceId is null || inheritedSizeInBytes is null || language is null || breakthroughMode is null || exportRules is null ? default : new VolumeProperties( + fileSystemId, + creationToken, + serviceLevel, + usageThreshold.Value, + new NetAppVolumeExportPolicyRule(exportRules, new Dictionary()), + protocolTypes, + provisioningState, + snapshotId, + deleteBaseSnapshot, + backupId, + baremetalTenantId, + subnetId, + networkFeatures, + effectiveNetworkFeatures, + networkSiblingSetId, + storageToNetworkProximity, + mountTargets, + volumeType, + dataProtection, + acceptGrowCapacityPoolForShortTermCloneSplit, + isRestoring, + snapshotDirectoryVisible, + kerberosEnabled, + securityStyle, + smbEncryption, + smbAccessBasedEnumeration, + smbNonBrowsable, + smbContinuouslyAvailable, + throughputMibps, + actualThroughputMibps, + encryptionKeySource, + keyVaultPrivateEndpointResourceId, + ldapEnabled, + ldapServerType, + coolAccess, + coolnessPeriod, + coolAccessRetrievalPolicy, + coolAccessTieringPolicy, + unixPermissions, + cloneProgress, + fileAccessLogs, + avsDataStore, + dataStoreResourceId, + isDefaultQuotaEnabled, + defaultUserQuotaInKiBs, + defaultGroupQuotaInKiBs, + maximumNumberOfFiles, + volumeGroupName, + capacityPoolResourceId, + proximityPlacementGroup, + t2Network, + volumeSpecName, + encrypted, + placementRules, + enableSubvolumes, + provisionedAvailabilityZone, + isLargeVolume, + largeVolumeType, + originatingResourceId, + inheritedSizeInBytes, + language, + breakthroughMode, + new Dictionary()), + additionalBinaryDataProperties: null); + } + + /// Mount target properties. /// UUID v4 used to identify the MountTarget. /// UUID v4 used to identify the MountTarget. /// The mount target's IPv4 address. /// The SMB server's Fully Qualified Domain Name, FQDN. - /// A new instance for mocking. - public static NetAppVolumeMountTarget NetAppVolumeMountTarget(Guid? mountTargetId = null, Guid fileSystemId = default, IPAddress ipAddress = null, string smbServerFqdn = null) + /// A new instance for mocking. + public static MountTargetProperties MountTargetProperties(string mountTargetId = default, string fileSystemId = default, string ipAddress = default, string smbServerFqdn = default) { - return new NetAppVolumeMountTarget(mountTargetId, fileSystemId, ipAddress, smbServerFqdn, serializedAdditionalRawData: null); + return new MountTargetProperties(mountTargetId, fileSystemId, ipAddress, smbServerFqdn, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Replication properties. /// Id. /// Indicates whether the local volume is the source or destination for the Volume Replication. /// Schedule. @@ -599,1935 +357,2214 @@ public static NetAppVolumeMountTarget NetAppVolumeMountTarget(Guid? mountTargetI /// Contains human-readable instructions on what the next step is to finish the external replication setup. /// The mirror state property describes the current status of data replication for a replication. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. /// The status of the Volume Replication. - /// A new instance for mocking. - public static NetAppReplicationObject NetAppReplicationObject(string replicationId = null, NetAppEndpointType? endpointType = null, NetAppReplicationSchedule? replicationSchedule = null, ResourceIdentifier remoteVolumeResourceId = null, RemotePath remotePath = null, string remoteVolumeRegion = null, IEnumerable destinationReplications = null, ExternalReplicationSetupStatus? externalReplicationSetupStatus = null, string externalReplicationSetupInfo = null, NetAppMirrorState? mirrorState = null, NetAppRelationshipStatus? relationshipStatus = null) + /// A new instance for mocking. + public static ReplicationObject ReplicationObject(string replicationId = default, NetAppEndpointType? endpointType = default, ReplicationSchedule? replicationSchedule = default, string remoteVolumeResourceId = default, RemotePath remotePath = default, string remoteVolumeRegion = default, IEnumerable destinationReplications = default, ExternalReplicationSetupStatus? externalReplicationSetupStatus = default, string externalReplicationSetupInfo = default, NetAppMirrorState? mirrorState = default, VolumeReplicationRelationshipStatus? relationshipStatus = default) { - destinationReplications ??= new List(); + destinationReplications ??= new ChangeTrackingList(); - return new NetAppReplicationObject( + return new ReplicationObject( replicationId, endpointType, replicationSchedule, remoteVolumeResourceId, remotePath, remoteVolumeRegion, - destinationReplications?.ToList(), + destinationReplications.ToList(), externalReplicationSetupStatus, externalReplicationSetupInfo, mirrorState, relationshipStatus, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Destination replication properties. /// The resource ID of the remote volume. /// Indicates whether the replication is cross zone or cross region. /// The remote region for the destination volume. /// The remote zone for the destination volume. - /// A new instance for mocking. - public static NetAppDestinationReplication NetAppDestinationReplication(ResourceIdentifier resourceId = null, NetAppReplicationType? replicationType = null, string region = null, string zone = null) + /// A new instance for mocking. + public static DestinationReplication DestinationReplication(ResourceIdentifier resourceId = default, ReplicationType? replicationType = default, string region = default, string zone = default) { - return new NetAppDestinationReplication(resourceId, replicationType, region, zone, serializedAdditionalRawData: null); + return new DestinationReplication(resourceId, replicationType, region, zone, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Has relocation been requested for this volume. - /// Has relocation finished and is ready to be cleaned up. - /// A new instance for mocking. - public static NetAppVolumeRelocationProperties NetAppVolumeRelocationProperties(bool? isRelocationRequested = null, bool? isReadyToBeFinalized = null) + /// Volume relocation properties. + /// Has relocation been requested for this volume. + /// Has relocation finished and is ready to be cleaned up. + /// A new instance for mocking. + public static VolumeRelocationProperties VolumeRelocationProperties(bool? relocationRequested = default, bool? readyToBeFinalized = default) { - return new NetAppVolumeRelocationProperties(isRelocationRequested, isReadyToBeFinalized, serializedAdditionalRawData: null); + return new VolumeRelocationProperties(relocationRequested, readyToBeFinalized, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. + /// Advanced Ransomware Protection reports (ARP) settings. + /// The desired value of the Advanced Ransomware Protection feature state available to the volume. + /// The actual state of the Advanced Ransomware Protection feature currently active on the volume. + /// A new instance for mocking. + public static RansomwareProtectionSettings RansomwareProtectionSettings(DesiredRansomwareProtectionState? desiredRansomwareProtectionState = default, ActualRansomwareProtectionState? actualRansomwareProtectionState = default) + { + return new RansomwareProtectionSettings(desiredRansomwareProtectionState, actualRansomwareProtectionState, additionalBinaryDataProperties: null); + } + + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Azure lifecycle management. + /// Volume group details. + /// A new instance for mocking. + public static VolumeGroup VolumeGroup(string location = default, string id = default, string name = default, string @type = default, string provisioningState = default, VolumeGroupMetaData groupMetaData = default) + { + return new VolumeGroup( + location, + id, + name, + @type, + provisioningState is null || groupMetaData is null ? default : new VolumeGroupListProperties(provisioningState, groupMetaData, new Dictionary()), + additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// UUID v4 used to identify the Backup. + /// The creation date of the backup. + /// The snapshot creation date of the backup. + /// The completion date of the backup. + /// Azure lifecycle management. + /// Size of backup in bytes. + /// Label for backup. + /// Type of backup Manual or Scheduled. + /// Failure reason. + /// ResourceId used to identify the Volume. + /// Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups. + /// The name of the snapshot. + /// ResourceId used to identify the backup policy. + /// Specifies if the backup is for a large volume. + /// A new instance for mocking. + public static BackupData BackupData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, string backupId = default, DateTimeOffset? createdOn = default, DateTimeOffset? snapshotCreationOn = default, DateTimeOffset? completionOn = default, string provisioningState = default, long? size = default, string label = default, NetAppBackupType? backupType = default, string failureReason = default, ResourceIdentifier volumeResourceId = default, bool? useExistingSnapshot = default, string snapshotName = default, ResourceIdentifier backupPolicyResourceId = default, bool? isLargeVolume = default) + { + return new BackupData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + backupId is null || createdOn is null || snapshotCreationOn is null || completionOn is null || provisioningState is null || size is null || label is null || backupType is null || failureReason is null || volumeResourceId is null || useExistingSnapshot is null || snapshotName is null || backupPolicyResourceId is null || isLargeVolume is null ? default : new BackupProperties( + backupId, + createdOn, + snapshotCreationOn, + completionOn, + provisioningState, + size, + label, + backupType, + failureReason, + volumeResourceId, + useExistingSnapshot, + snapshotName, + backupPolicyResourceId, + isLargeVolume, + new Dictionary())); + } + + /// Backup status. + /// Backup health status. + /// Status of the backup mirror relationship. + /// The status of the backup. + /// Reason for the unhealthy backup relationship. + /// Displays error message if the backup is in an error state. + /// Displays the last transfer size. + /// Displays the last transfer type. + /// Displays the total bytes transferred. + /// Displays the total number of bytes transferred for the ongoing operation. + /// A new instance for mocking. + public static NetAppVolumeBackupStatus NetAppVolumeBackupStatus(bool? healthy = default, VolumeBackupRelationshipStatus? relationshipStatus = default, NetAppMirrorState? mirrorState = default, string unhealthyReason = default, string errorMessage = default, long? lastTransferSize = default, string lastTransferType = default, long? totalTransferBytes = default, long? transferProgressBytes = default) + { + return new NetAppVolumeBackupStatus( + healthy, + relationshipStatus, + mirrorState, + unhealthyReason, + errorMessage, + lastTransferSize, + lastTransferType, + totalTransferBytes, + transferProgressBytes, + additionalBinaryDataProperties: null); + } + + /// Restore status. + /// Restore health status. + /// Status of the restore SnapMirror relationship. + /// The status of the restore. + /// Reason for the unhealthy restore relationship. + /// Displays error message if the restore is in an error state. + /// Displays the total bytes transferred. + /// A new instance for mocking. + public static NetAppRestoreStatus NetAppRestoreStatus(bool? healthy = default, VolumeRestoreRelationshipStatus? relationshipStatus = default, NetAppMirrorState? mirrorState = default, string unhealthyReason = default, string errorMessage = default, long? totalTransferBytes = default) + { + return new NetAppRestoreStatus( + healthy, + relationshipStatus, + mirrorState, + unhealthyReason, + errorMessage, + totalTransferBytes, + additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// Unique FileSystem Identifier. + /// A unique file path for the volume. Used when creating mount targets. + /// The service level of the file system. + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// + /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + /// Azure lifecycle management. + /// Resource identifier used to identify the Snapshot. + /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. + /// Resource identifier used to identify the Backup. + /// Unique Baremetal Tenant Identifier. + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. + /// The original value of the network features type available to the volume at the time it was created. + /// The effective value of the network features type available to the volume, or current effective state of update. + /// Network Sibling Set ID for the the group of volumes sharing networking resources. + /// Provides storage to network proximity information for the volume. + /// List of mount targets. + /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. For creating clone volume, set type to ShortTermClone. + /// DataProtection type volumes include an object containing details of the replication. + /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. + /// Restoring. + /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). + /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. + /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. + /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. + /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. + /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. + /// Enables continuously available share property for smb volume. Only applicable for SMB volume. + /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. + /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. + /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. + /// Specifies whether LDAP is enabled or not for a given NFS volume. + /// Specifies the type of LDAP server for a given NFS volume. + /// Specifies whether Cool Access(tiering) is enabled for the volume. + /// Specifies the number of days after which data that is not accessed by clients will be tiered. + /// + /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. + /// + /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. + /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. + /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. + /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. + /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. + /// Data store resource unique identifier. + /// Specifies if default quota is enabled for the volume. + /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . + /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. + /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. + /// Volume Group Name. + /// Pool Resource Id used in case of creating a volume through volume group. + /// Proximity placement group associated with the volume. + /// T2 network information. + /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. + /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. + /// Application specific placement rules for the particular volume. + /// Flag indicating whether subvolume operations are enabled on the volume. + /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. + /// Specifies whether volume is a Large Volume or Regular Volume. + /// + /// Specifies the type of the Large Volume. When set to 'LargeVolume', the large volume is created with standard configuration. + /// If it is set to 'ExtraLargeVolume7Dot2PiB', the extra large volume is created with higher capacity limit 7.2PiB with cool access enabled, + /// delivering higher capacity limit with lower costs. + /// + /// Id of the snapshot or backup that the volume is restored from. + /// Space shared by short term clone volume with parent volume in bytes. + /// Language supported for volume. + /// Specifies whether the volume operates in Breakthrough Mode. + /// Export policy rule. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + /// The availability zones. + /// or is null. + /// A new instance for mocking. + public static VolumeData VolumeData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string fileSystemId = default, string creationToken = default, NetAppFileServiceLevel? serviceLevel = default, long? usageThreshold = default, IList protocolTypes = default, string provisioningState = default, ResourceIdentifier snapshotId = default, bool? deleteBaseSnapshot = default, ResourceIdentifier backupId = default, string baremetalTenantId = default, string subnetId = default, NetworkFeatures? networkFeatures = default, NetworkFeatures? effectiveNetworkFeatures = default, string networkSiblingSetId = default, VolumeStorageToNetworkProximity? storageToNetworkProximity = default, IReadOnlyList mountTargets = default, string volumeType = default, VolumePropertiesDataProtection dataProtection = default, AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit = default, bool? isRestoring = default, bool? snapshotDirectoryVisible = default, bool? kerberosEnabled = default, SecurityStyle? securityStyle = default, bool? smbEncryption = default, SmbAccessBasedEnumeration? smbAccessBasedEnumeration = default, SmbNonBrowsable? smbNonBrowsable = default, bool? smbContinuouslyAvailable = default, float? throughputMibps = default, float? actualThroughputMibps = default, EncryptionKeySource? encryptionKeySource = default, string keyVaultPrivateEndpointResourceId = default, bool? ldapEnabled = default, LdapServerType? ldapServerType = default, bool? coolAccess = default, int? coolnessPeriod = default, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = default, CoolAccessTieringPolicy? coolAccessTieringPolicy = default, string unixPermissions = default, int? cloneProgress = default, FileAccessLogs? fileAccessLogs = default, AvsDataStore? avsDataStore = default, IReadOnlyList dataStoreResourceId = default, bool? isDefaultQuotaEnabled = default, long? defaultUserQuotaInKiBs = default, long? defaultGroupQuotaInKiBs = default, long? maximumNumberOfFiles = default, string volumeGroupName = default, string capacityPoolResourceId = default, string proximityPlacementGroup = default, string t2Network = default, string volumeSpecName = default, bool? encrypted = default, IList placementRules = default, EnableSubvolumes? enableSubvolumes = default, string provisionedAvailabilityZone = default, bool? isLargeVolume = default, LargeVolumeType? largeVolumeType = default, string originatingResourceId = default, long? inheritedSizeInBytes = default, VolumeLanguage? language = default, BreakthroughMode? breakthroughMode = default, IList exportRules = default, string etag = default, IEnumerable zones = default) + { + tags ??= new ChangeTrackingDictionary(); + zones ??= new ChangeTrackingList(); + + return new VolumeData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + fileSystemId is null || creationToken is null || serviceLevel is null || usageThreshold is null || protocolTypes is null || provisioningState is null || snapshotId is null || deleteBaseSnapshot is null || backupId is null || baremetalTenantId is null || subnetId is null || networkFeatures is null || effectiveNetworkFeatures is null || networkSiblingSetId is null || storageToNetworkProximity is null || mountTargets is null || volumeType is null || dataProtection is null || acceptGrowCapacityPoolForShortTermCloneSplit is null || isRestoring is null || snapshotDirectoryVisible is null || kerberosEnabled is null || securityStyle is null || smbEncryption is null || smbAccessBasedEnumeration is null || smbNonBrowsable is null || smbContinuouslyAvailable is null || throughputMibps is null || actualThroughputMibps is null || encryptionKeySource is null || keyVaultPrivateEndpointResourceId is null || ldapEnabled is null || ldapServerType is null || coolAccess is null || coolnessPeriod is null || coolAccessRetrievalPolicy is null || coolAccessTieringPolicy is null || unixPermissions is null || cloneProgress is null || fileAccessLogs is null || avsDataStore is null || dataStoreResourceId is null || isDefaultQuotaEnabled is null || defaultUserQuotaInKiBs is null || defaultGroupQuotaInKiBs is null || maximumNumberOfFiles is null || volumeGroupName is null || capacityPoolResourceId is null || proximityPlacementGroup is null || t2Network is null || volumeSpecName is null || encrypted is null || placementRules is null || enableSubvolumes is null || provisionedAvailabilityZone is null || isLargeVolume is null || largeVolumeType is null || originatingResourceId is null || inheritedSizeInBytes is null || language is null || breakthroughMode is null || exportRules is null ? default : new VolumeProperties( + fileSystemId, + creationToken, + serviceLevel, + usageThreshold.Value, + new NetAppVolumeExportPolicyRule(exportRules, new Dictionary()), + protocolTypes, + provisioningState, + snapshotId, + deleteBaseSnapshot, + backupId, + baremetalTenantId, + subnetId, + networkFeatures, + effectiveNetworkFeatures, + networkSiblingSetId, + storageToNetworkProximity, + mountTargets, + volumeType, + dataProtection, + acceptGrowCapacityPoolForShortTermCloneSplit, + isRestoring, + snapshotDirectoryVisible, + kerberosEnabled, + securityStyle, + smbEncryption, + smbAccessBasedEnumeration, + smbNonBrowsable, + smbContinuouslyAvailable, + throughputMibps, + actualThroughputMibps, + encryptionKeySource, + keyVaultPrivateEndpointResourceId, + ldapEnabled, + ldapServerType, + coolAccess, + coolnessPeriod, + coolAccessRetrievalPolicy, + coolAccessTieringPolicy, + unixPermissions, + cloneProgress, + fileAccessLogs, + avsDataStore, + dataStoreResourceId, + isDefaultQuotaEnabled, + defaultUserQuotaInKiBs, + defaultGroupQuotaInKiBs, + maximumNumberOfFiles, + volumeGroupName, + capacityPoolResourceId, + proximityPlacementGroup, + t2Network, + volumeSpecName, + encrypted, + placementRules, + enableSubvolumes, + provisionedAvailabilityZone, + isLargeVolume, + largeVolumeType, + originatingResourceId, + inheritedSizeInBytes, + language, + breakthroughMode, + new Dictionary()), + etag, + zones.ToList()); + } + + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// The service level of the file system. + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// + /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. /// DataProtection type volumes include an object containing details of the replication. /// Specifies if default quota is enabled for the volume. /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// Specifies whether Cool Access(tiering) is enabled for the volume. + /// Specifies whether Cool Access(tiering) is enabled for the volume. /// Specifies the number of days after which data that is not accessed by clients will be tiered. /// /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. /// /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots. + /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots. /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// A new instance for mocking. - public static NetAppVolumePatch NetAppVolumePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetAppFileServiceLevel? serviceLevel = null, long? usageThreshold = null, IEnumerable exportRules = null, IEnumerable protocolTypes = null, float? throughputMibps = null, NetAppVolumePatchDataProtection dataProtection = null, bool? isDefaultQuotaEnabled = null, long? defaultUserQuotaInKiBs = null, long? defaultGroupQuotaInKiBs = null, string unixPermissions = null, bool? isCoolAccessEnabled = null, int? coolnessPeriod = null, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = null, CoolAccessTieringPolicy? coolAccessTieringPolicy = null, bool? isSnapshotDirectoryVisible = null, SmbAccessBasedEnumeration? smbAccessBasedEnumeration = null, SmbNonBrowsable? smbNonBrowsable = null) + /// Export policy rule. + /// A new instance for mocking. + public static VolumePatch VolumePatch(string location = default, string id = default, string name = default, string @type = default, IDictionary tags = default, NetAppFileServiceLevel? serviceLevel = default, long? usageThreshold = default, IList protocolTypes = default, float? throughputMibps = default, VolumePatchPropertiesDataProtection dataProtection = default, bool? isDefaultQuotaEnabled = default, long? defaultUserQuotaInKiBs = default, long? defaultGroupQuotaInKiBs = default, string unixPermissions = default, bool? coolAccess = default, int? coolnessPeriod = default, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = default, CoolAccessTieringPolicy? coolAccessTieringPolicy = default, bool? snapshotDirectoryVisible = default, SmbAccessBasedEnumeration? smbAccessBasedEnumeration = default, SmbNonBrowsable? smbNonBrowsable = default, IList exportRules = default) { - tags ??= new Dictionary(); - exportRules ??= new List(); - protocolTypes ??= new List(); + tags ??= new ChangeTrackingDictionary(); - return new NetAppVolumePatch( + return new VolumePatch( + location, id, name, - resourceType, - systemData, + @type, tags, - location, - serviceLevel, - usageThreshold, - exportRules != null ? new VolumePatchPropertiesExportPolicy(exportRules?.ToList(), serializedAdditionalRawData: null) : null, - protocolTypes?.ToList(), - throughputMibps, - dataProtection, - isDefaultQuotaEnabled, - defaultUserQuotaInKiBs, - defaultGroupQuotaInKiBs, - unixPermissions, - isCoolAccessEnabled, - coolnessPeriod, - coolAccessRetrievalPolicy, - coolAccessTieringPolicy, - isSnapshotDirectoryVisible, - smbAccessBasedEnumeration, - smbNonBrowsable, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + serviceLevel is null || usageThreshold is null || protocolTypes is null || throughputMibps is null || dataProtection is null || isDefaultQuotaEnabled is null || defaultUserQuotaInKiBs is null || defaultGroupQuotaInKiBs is null || unixPermissions is null || coolAccess is null || coolnessPeriod is null || coolAccessRetrievalPolicy is null || coolAccessTieringPolicy is null || snapshotDirectoryVisible is null || smbAccessBasedEnumeration is null || smbNonBrowsable is null || exportRules is null ? default : new VolumePatchProperties( + serviceLevel, + usageThreshold, + new VolumePatchPropertiesExportPolicy(exportRules, new Dictionary()), + protocolTypes, + throughputMibps, + dataProtection, + isDefaultQuotaEnabled, + defaultUserQuotaInKiBs, + defaultGroupQuotaInKiBs, + unixPermissions, + coolAccess, + coolnessPeriod, + coolAccessRetrievalPolicy, + coolAccessTieringPolicy, + snapshotDirectoryVisible, + smbAccessBasedEnumeration, + smbNonBrowsable, + new Dictionary()), + additionalBinaryDataProperties: null); + } + + /// Get group Id list for LDAP User request. + /// username is required to fetch the group to which user is part of. + /// A new instance for mocking. + public static GetGroupIdListForLdapUserRequest GetGroupIdListForLdapUserRequest(string username = default) + { + return new GetGroupIdListForLdapUserRequest(username, additionalBinaryDataProperties: null); + } + + /// Group Id list for Ldap user. /// Group Id list. - /// A new instance for mocking. - public static GetGroupIdListForLdapUserResult GetGroupIdListForLdapUserResult(IEnumerable groupIdsForLdapUser = null) + /// A new instance for mocking. + public static GetGroupIdListForLdapUserResponse GetGroupIdListForLdapUserResponse(IEnumerable groupIdsForLdapUser = default) { - groupIdsForLdapUser ??= new List(); + groupIdsForLdapUser ??= new ChangeTrackingList(); - return new GetGroupIdListForLdapUserResult(groupIdsForLdapUser?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// List of volume quota report records. - /// A new instance for mocking. - public static NetAppVolumeQuotaReportListResult NetAppVolumeQuotaReportListResult(IEnumerable value = null) - { - value ??= new List(); - - return new NetAppVolumeQuotaReportListResult(value?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Type of quota. - /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. - /// Specifies the current usage in kibibytes for the user/group quota. - /// Specifies the total size limit in kibibytes for the user/group quota. - /// Percentage of used size compared to total size. - /// Flag to indicate whether the quota is derived from default quota. - /// A new instance for mocking. - public static NetAppVolumeQuotaReport NetAppVolumeQuotaReport(NetAppVolumeQuotaType? quotaType = null, string quotaTarget = null, long? quotaLimitUsedInKiBs = null, long? quotaLimitTotalInKiBs = null, float? percentageUsed = null, bool? isDerivedQuota = null) - { - return new NetAppVolumeQuotaReport( - quotaType, - quotaTarget, - quotaLimitUsedInKiBs, - quotaLimitTotalInKiBs, - percentageUsed, - isDerivedQuota, - serializedAdditionalRawData: null); + return new GetGroupIdListForLdapUserResponse(groupIdsForLdapUser.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Replication health check. - /// Status of the mirror relationship. - /// The mirror state property describes the current status of data replication for a replication. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. + /// Replication status. + /// Replication health check. + /// Status of the mirror relationship. + /// The status of the replication. /// The progress of the replication. /// Displays error message if the replication is in an error state. - /// A new instance for mocking. - public static NetAppVolumeReplicationStatus NetAppVolumeReplicationStatus(bool? isHealthy = null, VolumeReplicationRelationshipStatus? volumeReplicationRelationshipStatus = null, NetAppMirrorState? mirrorState = null, string totalProgress = null, string errorMessage = null) + /// A new instance for mocking. + public static ReplicationStatus ReplicationStatus(bool? healthy = default, VolumeReplicationRelationshipStatus? relationshipStatus = default, NetAppMirrorState? mirrorState = default, string totalProgress = default, string errorMessage = default) { - return new NetAppVolumeReplicationStatus( - isHealthy, - volumeReplicationRelationshipStatus, + return new ReplicationStatus( + healthy, + relationshipStatus, mirrorState, totalProgress, errorMessage, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Replication properties. /// UUID v4 used to identify the replication. /// Indicates whether the local volume is the source or destination for the Volume Replication. /// Schedule. /// The resource ID of the remote volume. /// The remote region for the other end of the Volume Replication. - /// A new instance for mocking. - public static NetAppVolumeReplication NetAppVolumeReplication(string replicationId = null, NetAppEndpointType? endpointType = null, NetAppReplicationSchedule? replicationSchedule = null, ResourceIdentifier remoteVolumeResourceId = null, string remoteVolumeRegion = null) + /// The status of the replication. + /// Replication creation time. + /// Replication deletion time. + /// A new instance for mocking. + public static Replication Replication(string replicationId = default, NetAppEndpointType? endpointType = default, ReplicationSchedule? replicationSchedule = default, string remoteVolumeResourceId = default, string remoteVolumeRegion = default, ReplicationMirrorState? mirrorState = default, DateTimeOffset? replicationCreationOn = default, DateTimeOffset? replicationDeletionOn = default) { - return new NetAppVolumeReplication( + return new Replication( replicationId, endpointType, replicationSchedule, remoteVolumeResourceId, remoteVolumeRegion, - serializedAdditionalRawData: null); + mirrorState, + replicationCreationOn, + replicationDeletionOn, + additionalBinaryDataProperties: null); + } + + /// Source Cluster properties for a cluster peer request. + /// A list of IC-LIF IPs that can be used to connect to the On-prem cluster. + /// A new instance for mocking. + public static PeerClusterForVolumeMigrationRequest PeerClusterForVolumeMigrationRequest(IEnumerable peerIpAddresses = default) + { + peerIpAddresses ??= new ChangeTrackingList(); + + return new PeerClusterForVolumeMigrationRequest(peerIpAddresses.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Information about cluster peering process. /// A command that needs to be run on the external ONTAP to accept cluster peering. Will only be present if <code>clusterPeeringStatus</code> is <code>pending</code>. - /// A new instance for mocking. - public static ClusterPeerCommandResult ClusterPeerCommandResult(string peerAcceptCommand = null) + /// A new instance for mocking. + public static ClusterPeerCommandResponse ClusterPeerCommandResponse(string peerAcceptCommand = default) { - return new ClusterPeerCommandResult(peerAcceptCommand, serializedAdditionalRawData: null); + return new ClusterPeerCommandResponse(peerAcceptCommand, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Information about svm peering process. /// A command that needs to be run on the external ONTAP to accept svm peering. Will only be present if <code>svmPeeringStatus</code> is <code>pending</code>. - /// A new instance for mocking. - public static SvmPeerCommandResult SvmPeerCommandResult(string svmPeeringCommand = null) + /// A new instance for mocking. + public static SvmPeerCommandResponse SvmPeerCommandResponse(string svmPeeringCommand = default) { - return new SvmPeerCommandResult(svmPeeringCommand, serializedAdditionalRawData: null); + return new SvmPeerCommandResponse(svmPeeringCommand, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Resource location. + /// Pool change request. + /// Resource id of the pool to move volume to. + /// A new instance for mocking. + public static PoolChangeRequest PoolChangeRequest(string newPoolResourceId = default) + { + return new PoolChangeRequest(newPoolResourceId, additionalBinaryDataProperties: null); + } + + /// Quota Report for volume. + /// List of quota reports. + /// A new instance for mocking. + public static ListQuotaReportResponse ListQuotaReportResponse(IEnumerable value = default) + { + value ??= new ChangeTrackingList(); + + return new ListQuotaReportResponse(value.ToList(), additionalBinaryDataProperties: null); + } + + /// Quota report record properties. + /// Type of quota. + /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. + /// Specifies the current usage in kibibytes for the user/group quota. + /// Specifies the total size limit in kibibytes for the user/group quota. + /// Percentage of used size compared to total size. + /// Flag to indicate whether the quota is derived from default quota. + /// A new instance for mocking. + public static QuotaReport QuotaReport(Type? quotaType = default, string quotaTarget = default, long? quotaLimitUsedInKiBs = default, long? quotaLimitTotalInKiBs = default, float? percentageUsed = default, bool? isDerivedQuota = default) + { + return new QuotaReport( + quotaType, + quotaTarget, + quotaLimitUsedInKiBs, + quotaLimitTotalInKiBs, + percentageUsed, + isDerivedQuota, + additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// UUID v4 used to identify the Snapshot. /// The creation date of the snapshot. /// Azure lifecycle management. - /// A new instance for mocking. - public static NetAppVolumeSnapshotData NetAppVolumeSnapshotData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation location = default, string snapshotId = null, DateTimeOffset? created = null, string provisioningState = null) + /// Resource location. + /// A new instance for mocking. + public static SnapshotData SnapshotData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, string snapshotId = default, DateTimeOffset? created = default, string provisioningState = default, string location = default) { - return new NetAppVolumeSnapshotData( + return new SnapshotData( id, name, resourceType, systemData, - location, - snapshotId, - created, - provisioningState, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + snapshotId is null || created is null || provisioningState is null ? default : new SnapshotProperties(snapshotId, created, provisioningState, new Dictionary()), + location); + } + + /// Restore payload for Single File Snapshot Restore. + /// List of files to be restored. + /// Destination folder where the files will be restored. + /// A new instance for mocking. + public static SnapshotRestoreFiles SnapshotRestoreFiles(IEnumerable filePaths = default, string destinationPath = default) + { + filePaths ??= new ChangeTrackingList(); + + return new SnapshotRestoreFiles(filePaths.ToList(), destinationPath, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. /// Schedule for hourly snapshots. /// Schedule for daily snapshots. /// Schedule for weekly snapshots. /// Schedule for monthly snapshots. - /// The property to decide policy is enabled or not. + /// The property to decide policy is enabled or not. /// Azure lifecycle management. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). /// A new instance for mocking. - public static SnapshotPolicyData SnapshotPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, SnapshotPolicyHourlySchedule hourlySchedule = null, SnapshotPolicyDailySchedule dailySchedule = null, SnapshotPolicyWeeklySchedule weeklySchedule = null, SnapshotPolicyMonthlySchedule monthlySchedule = null, bool? isEnabled = null, string provisioningState = null) + public static SnapshotPolicyData SnapshotPolicyData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, HourlySchedule hourlySchedule = default, DailySchedule dailySchedule = default, WeeklySchedule weeklySchedule = default, MonthlySchedule monthlySchedule = default, bool? enabled = default, string provisioningState = default, string etag = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new SnapshotPolicyData( id, name, resourceType, systemData, + additionalBinaryDataProperties: null, tags, location, - etag, - hourlySchedule, - dailySchedule, - weeklySchedule, - monthlySchedule, - isEnabled, - provisioningState, - serializedAdditionalRawData: null); + hourlySchedule is null || dailySchedule is null || weeklySchedule is null || monthlySchedule is null || enabled is null || provisioningState is null ? default : new SnapshotPolicyProperties( + hourlySchedule, + dailySchedule, + weeklySchedule, + monthlySchedule, + enabled, + provisioningState, + new Dictionary()), + etag); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. /// Schedule for hourly snapshots. /// Schedule for daily snapshots. /// Schedule for weekly snapshots. /// Schedule for monthly snapshots. - /// The property to decide policy is enabled or not. + /// The property to decide policy is enabled or not. /// Azure lifecycle management. /// A new instance for mocking. - public static SnapshotPolicyPatch SnapshotPolicyPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SnapshotPolicyHourlySchedule hourlySchedule = null, SnapshotPolicyDailySchedule dailySchedule = null, SnapshotPolicyWeeklySchedule weeklySchedule = null, SnapshotPolicyMonthlySchedule monthlySchedule = null, bool? isEnabled = null, string provisioningState = null) + public static SnapshotPolicyPatch SnapshotPolicyPatch(string location = default, string id = default, string name = default, string @type = default, IDictionary tags = default, HourlySchedule hourlySchedule = default, DailySchedule dailySchedule = default, WeeklySchedule weeklySchedule = default, MonthlySchedule monthlySchedule = default, bool? enabled = default, string provisioningState = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new SnapshotPolicyPatch( + location, id, name, - resourceType, - systemData, + @type, tags, - location, - hourlySchedule, - dailySchedule, - weeklySchedule, - monthlySchedule, - isEnabled, - provisioningState, - serializedAdditionalRawData: null); + hourlySchedule is null || dailySchedule is null || weeklySchedule is null || monthlySchedule is null || enabled is null || provisioningState is null ? default : new SnapshotPolicyProperties( + hourlySchedule, + dailySchedule, + weeklySchedule, + monthlySchedule, + enabled, + provisioningState, + new Dictionary()), + additionalBinaryDataProperties: null); + } + + /// Volumes associated with snapshot policy. + /// The Volume items on this page. + /// The link to the next page of items. + /// A new instance for mocking. + public static SnapshotPolicyVolumeList SnapshotPolicyVolumeList(IEnumerable value = default, Uri nextLink = default) + { + value ??= new ChangeTrackingList(); + + return new SnapshotPolicyVolumeList(value.ToList(), nextLink, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. /// Backup Policy GUID ID. /// Azure lifecycle management. /// Daily backups count to keep. /// Weekly backups count to keep. /// Monthly backups count to keep. /// Volumes using current backup policy. - /// The property to decide policy is enabled or not. + /// The property to decide policy is enabled or not. /// A list of volumes assigned to this policy. - /// A new instance for mocking. - public static NetAppBackupPolicyData NetAppBackupPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, ResourceIdentifier backupPolicyId = null, string provisioningState = null, int? dailyBackupsToKeep = null, int? weeklyBackupsToKeep = null, int? monthlyBackupsToKeep = null, int? volumesAssigned = null, bool? isEnabled = null, IEnumerable volumeBackups = null) + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + /// A new instance for mocking. + public static BackupPolicyData BackupPolicyData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string backupPolicyId = default, string provisioningState = default, int? dailyBackupsToKeep = default, int? weeklyBackupsToKeep = default, int? monthlyBackupsToKeep = default, int? volumesAssigned = default, bool? enabled = default, IReadOnlyList volumeBackups = default, string etag = default) { - tags ??= new Dictionary(); - volumeBackups ??= new List(); + tags ??= new ChangeTrackingDictionary(); - return new NetAppBackupPolicyData( + return new BackupPolicyData( id, name, resourceType, systemData, + additionalBinaryDataProperties: null, tags, location, - etag, - backupPolicyId, - provisioningState, - dailyBackupsToKeep, - weeklyBackupsToKeep, - monthlyBackupsToKeep, - volumesAssigned, - isEnabled, - volumeBackups?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + backupPolicyId is null || provisioningState is null || dailyBackupsToKeep is null || weeklyBackupsToKeep is null || monthlyBackupsToKeep is null || volumesAssigned is null || enabled is null || volumeBackups is null ? default : new BackupPolicyProperties( + backupPolicyId, + provisioningState, + dailyBackupsToKeep, + weeklyBackupsToKeep, + monthlyBackupsToKeep, + volumesAssigned, + enabled, + volumeBackups, + new Dictionary()), + etag); + } + + /// Volume details using the backup policy. /// Volume name. /// ResourceId used to identify the Volume. /// Total count of backups for volume. - /// Policy enabled. - /// A new instance for mocking. - public static NetAppVolumeBackupDetail NetAppVolumeBackupDetail(string volumeName = null, ResourceIdentifier volumeResourceId = null, int? backupsCount = null, bool? isPolicyEnabled = null) + /// Policy enabled. + /// A new instance for mocking. + public static VolumeBackups VolumeBackups(string volumeName = default, ResourceIdentifier volumeResourceId = default, int? backupsCount = default, bool? policyEnabled = default) { - return new NetAppVolumeBackupDetail(volumeName, volumeResourceId, backupsCount, isPolicyEnabled, serializedAdditionalRawData: null); + return new VolumeBackups(volumeName, volumeResourceId, backupsCount, policyEnabled, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. /// Backup Policy GUID ID. /// Azure lifecycle management. /// Daily backups count to keep. /// Weekly backups count to keep. /// Monthly backups count to keep. /// Volumes using current backup policy. - /// The property to decide policy is enabled or not. + /// The property to decide policy is enabled or not. /// A list of volumes assigned to this policy. - /// A new instance for mocking. - public static NetAppBackupPolicyPatch NetAppBackupPolicyPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ResourceIdentifier backupPolicyId = null, string provisioningState = null, int? dailyBackupsToKeep = null, int? weeklyBackupsToKeep = null, int? monthlyBackupsToKeep = null, int? volumesAssigned = null, bool? isEnabled = null, IEnumerable volumeBackups = null) + /// A new instance for mocking. + public static BackupPolicyPatch BackupPolicyPatch(string location = default, string id = default, string name = default, string @type = default, IDictionary tags = default, string backupPolicyId = default, string provisioningState = default, int? dailyBackupsToKeep = default, int? weeklyBackupsToKeep = default, int? monthlyBackupsToKeep = default, int? volumesAssigned = default, bool? enabled = default, IReadOnlyList volumeBackups = default) { - tags ??= new Dictionary(); - volumeBackups ??= new List(); + tags ??= new ChangeTrackingDictionary(); - return new NetAppBackupPolicyPatch( + return new BackupPolicyPatch( + location, id, name, - resourceType, - systemData, + @type, tags, - location, - backupPolicyId, - provisioningState, - dailyBackupsToKeep, - weeklyBackupsToKeep, - monthlyBackupsToKeep, - volumesAssigned, - isEnabled, - volumeBackups?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Provisioning state of the resource. + backupPolicyId is null || provisioningState is null || dailyBackupsToKeep is null || weeklyBackupsToKeep is null || monthlyBackupsToKeep is null || volumesAssigned is null || enabled is null || volumeBackups is null ? default : new BackupPolicyProperties( + backupPolicyId, + provisioningState, + dailyBackupsToKeep, + weeklyBackupsToKeep, + monthlyBackupsToKeep, + volumesAssigned, + enabled, + volumeBackups, + new Dictionary()), + additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// Gets the status of the VolumeQuotaRule at the time the operation was called. /// Size of quota. /// Type of quota. /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. - /// A new instance for mocking. - public static NetAppVolumeQuotaRuleData NetAppVolumeQuotaRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NetAppProvisioningState? provisioningState = null, long? quotaSizeInKiBs = null, NetAppVolumeQuotaType? quotaType = null, string quotaTarget = null) + /// A new instance for mocking. + public static VolumeQuotaRuleData VolumeQuotaRuleData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, Models.NetAppProvisioningState? provisioningState = default, long? quotaSizeInKiBs = default, Type? quotaType = default, string quotaTarget = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); - return new NetAppVolumeQuotaRuleData( + return new VolumeQuotaRuleData( id, name, resourceType, systemData, + additionalBinaryDataProperties: null, tags, location, - provisioningState, - quotaSizeInKiBs, - quotaType, - quotaTarget, - serializedAdditionalRawData: null); + provisioningState is null || quotaSizeInKiBs is null || quotaType is null || quotaTarget is null ? default : new VolumeQuotaRulesProperties(provisioningState, quotaSizeInKiBs, quotaType, quotaTarget, new Dictionary())); } - /// Initializes a new instance of . /// Resource tags. - /// Provisioning state of the resource. + /// Gets the status of the VolumeQuotaRule at the time the operation was called. /// Size of quota. /// Type of quota. /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. - /// A new instance for mocking. - public static NetAppVolumeQuotaRulePatch NetAppVolumeQuotaRulePatch(IDictionary tags = null, NetAppProvisioningState? provisioningState = null, long? quotaSizeInKiBs = null, NetAppVolumeQuotaType? quotaType = null, string quotaTarget = null) - { - tags ??= new Dictionary(); - - return new NetAppVolumeQuotaRulePatch( - tags, - provisioningState, - quotaSizeInKiBs, - quotaType, - quotaTarget, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Resource location. - /// Azure lifecycle management. - /// Volume group details. - /// A new instance for mocking. - public static NetAppVolumeGroupResult NetAppVolumeGroupResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, string provisioningState = null, NetAppVolumeGroupMetadata groupMetaData = null) - { - return new NetAppVolumeGroupResult( - id, - name, - resourceType, - systemData, - location, - provisioningState, - groupMetaData, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Group Description. - /// Application Type. - /// Application specific identifier. - /// Application specific placement rules for the volume group. - /// Number of volumes in volume group. - /// A new instance for mocking. - public static NetAppVolumeGroupMetadata NetAppVolumeGroupMetadata(string groupDescription = null, NetAppApplicationType? applicationType = null, string applicationIdentifier = null, IEnumerable globalPlacementRules = null, long? volumesCount = null) + /// A new instance for mocking. + public static VolumeQuotaRulePatch VolumeQuotaRulePatch(IDictionary tags = default, Models.NetAppProvisioningState? provisioningState = default, long? quotaSizeInKiBs = default, Type? quotaType = default, string quotaTarget = default) { - globalPlacementRules ??= new List(); + tags ??= new ChangeTrackingDictionary(); - return new NetAppVolumeGroupMetadata( - groupDescription, - applicationType, - applicationIdentifier, - globalPlacementRules?.ToList(), - volumesCount, - serializedAdditionalRawData: null); + return new VolumeQuotaRulePatch(tags, provisioningState is null || quotaSizeInKiBs is null || quotaType is null || quotaTarget is null ? default : new VolumeQuotaRulesProperties(provisioningState, quotaSizeInKiBs, quotaType, quotaTarget, new Dictionary()), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Resource location. - /// Azure lifecycle management. - /// Volume group details. - /// List of volumes from group. - /// A new instance for mocking. - public static NetAppVolumeGroupData NetAppVolumeGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, string provisioningState = null, NetAppVolumeGroupMetadata groupMetaData = null, IEnumerable volumes = null) + /// + /// Advanced Ransomware Protection (ARP) report + /// Get details of the specified Advanced Ransomware Protection report (ARP). + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Advanced Ransomware Protection reports Properties. + /// A new instance for mocking. + public static RansomwareReportData RansomwareReportData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, RansomwareReportProperties properties = default) { - volumes ??= new List(); - - return new NetAppVolumeGroupData( + return new RansomwareReportData( id, name, resourceType, systemData, - location, - provisioningState, - groupMetaData, - volumes?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Resource Id. - /// Resource name. - /// Resource type. - /// Resource tags. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + additionalBinaryDataProperties: null, + properties); + } + + /// + /// Advanced Ransomware Protection (ARP) report properties. + /// + /// Evaluate the report to determine whether the activity is acceptable (false positive) or whether an attack seems malicious using the ClearSuspects operation. + /// + /// Advanced Ransomware Protection (ARP) creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of the ARP snapshots or another snapshot of your volume to restore data. + /// + /// The creation date and time of the report. + /// State of the Advanced Ransomware Protection (ARP) report. + /// Severity of the Advanced Ransomware Protection (ARP) report. + /// The number of cleared suspects identified by the ARP report. + /// The number of suspects identified by the ARP report. + /// Suspects identified in an ARP report. /// Azure lifecycle management. - /// Resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// Resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// The original value of the network features type available to the volume at the time it was created. - /// The effective value of the network features type available to the volume, or current effective state of update. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. For creating clone volume, set type to ShortTermClone. - /// DataProtection type volumes include an object containing details of the replication. - /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies the type of LDAP server for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. Avoid passing null value for unixPermissions in volume update operation, As per the behavior, If Null value is passed then user-visible unixPermissions value will became null, and user will not be able to get unixPermissions value. On safer side, actual unixPermissions value on volume will remain as its last saved value only. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// Space shared by short term clone volume with parent volume in bytes. - /// Language supported for volume. - /// A new instance for mocking. - public static NetAppVolumeGroupVolume NetAppVolumeGroupVolume(ResourceIdentifier id = null, string name = null, ResourceType? resourceType = null, IDictionary tags = null, IEnumerable zones = null, Guid? fileSystemId = null, string creationToken = null, NetAppFileServiceLevel? serviceLevel = null, long usageThreshold = default, IEnumerable exportRules = null, IEnumerable protocolTypes = null, string provisioningState = null, string snapshotId = null, bool? deleteBaseSnapshot = null, string backupId = null, string baremetalTenantId = null, ResourceIdentifier subnetId = null, NetAppNetworkFeature? networkFeatures = null, NetAppNetworkFeature? effectiveNetworkFeatures = null, Guid? networkSiblingSetId = null, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity = null, IEnumerable mountTargets = null, string volumeType = null, NetAppVolumeDataProtection dataProtection = null, AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit = null, bool? isRestoring = null, bool? isSnapshotDirectoryVisible = null, bool? isKerberosEnabled = null, NetAppVolumeSecurityStyle? securityStyle = null, bool? isSmbEncryptionEnabled = null, SmbAccessBasedEnumeration? smbAccessBasedEnumeration = null, SmbNonBrowsable? smbNonBrowsable = null, bool? isSmbContinuouslyAvailable = null, float? throughputMibps = null, float? actualThroughputMibps = null, NetAppEncryptionKeySource? encryptionKeySource = null, ResourceIdentifier keyVaultPrivateEndpointResourceId = null, bool? isLdapEnabled = null, LdapServerType? ldapServerType = null, bool? isCoolAccessEnabled = null, int? coolnessPeriod = null, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = null, CoolAccessTieringPolicy? coolAccessTieringPolicy = null, string unixPermissions = null, int? cloneProgress = null, NetAppFileAccessLog? fileAccessLogs = null, NetAppAvsDataStore? avsDataStore = null, IEnumerable dataStoreResourceId = null, bool? isDefaultQuotaEnabled = null, long? defaultUserQuotaInKiBs = null, long? defaultGroupQuotaInKiBs = null, long? maximumNumberOfFiles = null, string volumeGroupName = null, ResourceIdentifier capacityPoolResourceId = null, ResourceIdentifier proximityPlacementGroupId = null, string t2Network = null, string volumeSpecName = null, bool? isEncrypted = null, IEnumerable placementRules = null, EnableNetAppSubvolume? enableSubvolumes = null, string provisionedAvailabilityZone = null, bool? isLargeVolume = null, ResourceIdentifier originatingResourceId = null, long? inheritedSizeInBytes = null, NetAppVolumeLanguage? language = null) - { - tags ??= new Dictionary(); - zones ??= new List(); - exportRules ??= new List(); - protocolTypes ??= new List(); - mountTargets ??= new List(); - dataStoreResourceId ??= new List(); - placementRules ??= new List(); - - return new NetAppVolumeGroupVolume( - id, - name, - resourceType, - tags, - zones?.ToList(), - fileSystemId, - creationToken, - serviceLevel, - usageThreshold, - exportRules != null ? new VolumePropertiesExportPolicy(exportRules?.ToList(), serializedAdditionalRawData: null) : null, - protocolTypes?.ToList(), + /// A new instance for mocking. + public static RansomwareReportProperties RansomwareReportProperties(DateTimeOffset? eventOn = default, RansomwareReportState? state = default, RansomwareReportSeverity? severity = default, int? clearedCount = default, int? reportedCount = default, IEnumerable suspects = default, string provisioningState = default) + { + suspects ??= new ChangeTrackingList(); + + return new RansomwareReportProperties( + eventOn, + state, + severity, + clearedCount, + reportedCount, + suspects.ToList(), provisioningState, - snapshotId, - deleteBaseSnapshot, - backupId, - baremetalTenantId, - subnetId, - networkFeatures, - effectiveNetworkFeatures, - networkSiblingSetId, - storageToNetworkProximity, - mountTargets?.ToList(), - volumeType, - dataProtection, - acceptGrowCapacityPoolForShortTermCloneSplit, - isRestoring, - isSnapshotDirectoryVisible, - isKerberosEnabled, - securityStyle, - isSmbEncryptionEnabled, - smbAccessBasedEnumeration, - smbNonBrowsable, - isSmbContinuouslyAvailable, - throughputMibps, - actualThroughputMibps, - encryptionKeySource, - keyVaultPrivateEndpointResourceId, - isLdapEnabled, - ldapServerType, - isCoolAccessEnabled, - coolnessPeriod, - coolAccessRetrievalPolicy, - coolAccessTieringPolicy, - unixPermissions, - cloneProgress, - fileAccessLogs, - avsDataStore, - dataStoreResourceId?.ToList(), - isDefaultQuotaEnabled, - defaultUserQuotaInKiBs, - defaultGroupQuotaInKiBs, - maximumNumberOfFiles, - volumeGroupName, - capacityPoolResourceId, - proximityPlacementGroupId, - t2Network, - volumeSpecName, - isEncrypted, - placementRules?.ToList(), - enableSubvolumes, - provisionedAvailabilityZone, - isLargeVolume, - originatingResourceId, - inheritedSizeInBytes, - language, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Path to the subvolume. - /// Truncate subvolume to the provided size in bytes. - /// parent path to the subvolume. - /// Azure lifecycle management. - /// A new instance for mocking. - public static NetAppSubvolumeInfoData NetAppSubvolumeInfoData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string path = null, long? size = null, string parentPath = null, string provisioningState = null) + /// List of suspects identified in an Advanced Ransomware Protection (ARP) report. + /// Suspect File extension. + /// ARP report suspect resolution. + /// The number of suspect files at the time of ARP report, this number can change as files get created and report status progresses. + /// Suspect files. + /// A new instance for mocking. + public static RansomwareSuspects RansomwareSuspects(string extension = default, RansomwareSuspectResolution? resolution = default, int? fileCount = default, IEnumerable suspectFiles = default) { - return new NetAppSubvolumeInfoData( - id, - name, - resourceType, - systemData, - path, - size, - parentPath, - provisioningState, - serializedAdditionalRawData: null); - } + suspectFiles ??= new ChangeTrackingList(); - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Path to the subvolume. - /// Path to the parent subvolume. - /// Size of subvolume. - /// Bytes used. - /// Permissions of the subvolume. - /// Creation time and date. - /// Most recent access time and date. - /// Most recent modification time and date. - /// Most recent change time and date. - /// Azure lifecycle management. - /// A new instance for mocking. - public static NetAppSubvolumeMetadata NetAppSubvolumeMetadata(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string path = null, string parentPath = null, long? size = null, long? bytesUsed = null, string permissions = null, DateTimeOffset? createdOn = null, DateTimeOffset? accessedOn = null, DateTimeOffset? modifiedOn = null, DateTimeOffset? changedOn = null, string provisioningState = null) - { - return new NetAppSubvolumeMetadata( - id, - name, - resourceType, - systemData, - path, - parentPath, - size, - bytesUsed, - permissions, - createdOn, - accessedOn, - modifiedOn, - changedOn, - provisioningState, - serializedAdditionalRawData: null); + return new RansomwareSuspects(extension, resolution, fileCount, suspectFiles.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Backup health status. - /// Status of the backup mirror relationship. - /// The mirror state property describes the current status of data replication for a backup. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. - /// Reason for the unhealthy backup relationship. - /// Displays error message if the backup is in an error state. - /// Displays the last transfer size. - /// Displays the last transfer type. - /// Displays the total bytes transferred. - /// Displays the total number of bytes transferred for the ongoing operation. - /// A new instance for mocking. - public static NetAppVolumeBackupStatus NetAppVolumeBackupStatus(bool? isHealthy = null, NetAppRelationshipStatus? relationshipStatus = null, NetAppMirrorState? mirrorState = null, string unhealthyReason = null, string errorMessage = null, long? lastTransferSize = null, string lastTransferType = null, long? totalTransferBytes = null, long? transferProgressBytes = null) + /// Suspect file information. + /// Suspect filename. + /// The creation date and time of the file. + /// A new instance for mocking. + public static SuspectFile SuspectFile(string suspectFileName = default, DateTimeOffset? fileTimestamp = default) { - return new NetAppVolumeBackupStatus( - isHealthy, - relationshipStatus, - mirrorState, - unhealthyReason, - errorMessage, - lastTransferSize, - lastTransferType, - totalTransferBytes, - transferProgressBytes, - serializedAdditionalRawData: null); + return new SuspectFile(suspectFileName, fileTimestamp, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Restore health status. - /// Status of the restore SnapMirror relationship. - /// The mirror state property describes the current status of data replication for a restore. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. - /// Reason for the unhealthy restore relationship. - /// Displays error message if the restore is in an error state. - /// Displays the total bytes transferred. - /// A new instance for mocking. - public static NetAppRestoreStatus NetAppRestoreStatus(bool? isHealthy = null, NetAppRelationshipStatus? relationshipStatus = null, NetAppMirrorState? mirrorState = null, string unhealthyReason = null, string errorMessage = null, long? totalTransferBytes = null) + /// Clear suspects for Advanced Ransomware Protection (ARP) report. + /// ARP report suspect resolution. + /// List of file extensions resolved (PotentialThreat or FalsePositive). + /// A new instance for mocking. + public static RansomwareSuspectsClearRequest RansomwareSuspectsClearRequest(RansomwareSuspectResolution resolution = default, IEnumerable extensions = default) { - return new NetAppRestoreStatus( - isHealthy, - relationshipStatus, - mirrorState, - unhealthyReason, - errorMessage, - totalTransferBytes, - serializedAdditionalRawData: null); + extensions ??= new ChangeTrackingList(); + + return new RansomwareSuspectsClearRequest(resolution, extensions.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// UUID v4 used to identify the Backup. - /// The creation date of the backup. - /// The snapshot creation date of the backup. - /// The completion date of the backup. - /// Azure lifecycle management. - /// Size of backup in bytes. - /// Label for backup. - /// Type of backup Manual or Scheduled. - /// Failure reason. - /// ResourceId used to identify the Volume. - /// Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups. - /// The name of the snapshot. - /// ResourceId used to identify the backup policy. - /// Specifies if the backup is for a large volume. - /// A new instance for mocking. - public static NetAppBackupData NetAppBackupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string backupId = null, DateTimeOffset? createdOn = null, DateTimeOffset? snapshotCreationOn = null, DateTimeOffset? completionOn = null, string provisioningState = null, long? size = null, string label = null, NetAppBackupType? backupType = null, string failureReason = null, ResourceIdentifier volumeResourceId = null, bool? useExistingSnapshot = null, string snapshotName = null, ResourceIdentifier backupPolicyArmResourceId = null, bool? isLargeVolume = null) - { - return new NetAppBackupData( - id, - name, - resourceType, - systemData, - backupId, - createdOn, - snapshotCreationOn, - completionOn, - provisioningState, - size, - label, - backupType, - failureReason, - volumeResourceId, - useExistingSnapshot, - snapshotName, - backupPolicyArmResourceId, - isLargeVolume, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. /// Azure lifecycle management. - /// A new instance for mocking. - public static NetAppBackupVaultData NetAppBackupVaultData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string provisioningState = null) + /// A new instance for mocking. + public static BackupVaultData BackupVaultData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string provisioningState = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); - return new NetAppBackupVaultData( + return new BackupVaultData( id, name, resourceType, systemData, + additionalBinaryDataProperties: null, tags, location, - provisioningState, - serializedAdditionalRawData: null); + provisioningState is null ? default : new BackupVaultProperties(provisioningState, new Dictionary())); } - /// Initializes a new instance of . - /// List of files to be restored. - /// Destination folder where the files will be restored. The path name should start with a forward slash. If it is omitted from request then restore is done at the root folder of the destination volume by default. - /// Resource Id of the destination volume on which the files need to be restored. - /// A new instance for mocking. - public static NetAppVolumeBackupBackupRestoreFilesContent NetAppVolumeBackupBackupRestoreFilesContent(IEnumerable fileList = null, string restoreFilePath = null, ResourceIdentifier destinationVolumeId = null) + /// Backup Vault information. + /// Resource tags. + /// A new instance for mocking. + public static BackupVaultPatch BackupVaultPatch(IDictionary tags = default) { - fileList ??= new List(); + tags ??= new ChangeTrackingDictionary(); - return new NetAppVolumeBackupBackupRestoreFilesContent(fileList?.ToList(), restoreFilePath, destinationVolumeId, serializedAdditionalRawData: null); + return new BackupVaultPatch(tags, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// The volume path mounted inside the bucket. The default is the root path '/' if no value is provided when the bucket is created. /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. /// Provisioning state of the resource. /// /// The bucket credentials status. There states: - /// + /// /// "NoCredentialsSet": Access and Secret key pair have not been generated. /// "CredentialsExpired": Access and Secret key pair have expired. /// "Active": The certificate has been installed and credentials are unexpired. /// /// Properties of the server managing the lifecycle of volume buckets. /// Access permissions for the bucket. Either ReadOnly or ReadWrite. The default is ReadOnly if no value is provided during bucket creation. - /// A new instance for mocking. - public static NetAppBucketData NetAppBucketData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string path = null, NetAppBucketFileSystemUser fileSystemUser = null, NetAppProvisioningState? provisioningState = null, NetAppBucketCredentialStatus? status = null, NetAppBucketServerProperties server = null, NetAppBucketPermission? permissions = null) + /// A new instance for mocking. + public static BucketData BucketData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, string path = default, FileSystemUser fileSystemUser = default, Models.NetAppProvisioningState? provisioningState = default, CredentialsStatus? status = default, BucketServerProperties server = default, BucketPermissions? permissions = default) { - return new NetAppBucketData( + return new BucketData( id, name, resourceType, systemData, - path, - fileSystemUser, - provisioningState, - status, - server, - permissions, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + additionalBinaryDataProperties: null, + path is null || fileSystemUser is null || provisioningState is null || status is null || server is null || permissions is null ? default : new BucketProperties( + path, + fileSystemUser, + provisioningState, + status, + server, + permissions, + new Dictionary())); + } + + /// Properties of the server managing the lifecycle of volume buckets. /// The host part of the bucket URL, resolving to the bucket IP address and allowed by the server certificate. /// Certificate Common Name taken from the certificate installed on the bucket server. /// The bucket server's certificate expiry date. /// The bucket server's IPv4 address. /// A base64-encoded PEM file, which includes both the bucket server's certificate and private key. It is used to authenticate the user and allows access to volume data in a read-only manner. - /// A new instance for mocking. - public static NetAppBucketServerProperties NetAppBucketServerProperties(string fqdn = null, string certificateCommonName = null, DateTimeOffset? certificateExpiryOn = null, string ipAddress = null, string certificateObject = null) + /// A new instance for mocking. + public static BucketServerProperties BucketServerProperties(string fqdn = default, string certificateCommonName = default, DateTimeOffset? certificateExpiryOn = default, string ipAddress = default, string certificateObject = default) { - return new NetAppBucketServerProperties( + return new BucketServerProperties( fqdn, certificateCommonName, certificateExpiryOn, ipAddress, certificateObject, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// The volume path mounted inside the bucket. /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. /// Provisioning state of the resource. /// Properties of the server managing the lifecycle of volume buckets. /// Access permissions for the bucket. Either ReadOnly or ReadWrite. - /// A new instance for mocking. - public static NetAppBucketPatch NetAppBucketPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string path = null, NetAppBucketFileSystemUser fileSystemUser = null, NetAppProvisioningState? provisioningState = null, NetAppBucketServerPatchProperties server = null, NetAppBucketPatchPermission? permissions = null) + /// A new instance for mocking. + public static BucketPatch BucketPatch(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, string path = default, FileSystemUser fileSystemUser = default, Models.NetAppProvisioningState? provisioningState = default, BucketServerPatchProperties server = default, BucketPatchPermissions? permissions = default) { - return new NetAppBucketPatch( + return new BucketPatch( id, name, resourceType, systemData, - path, - fileSystemUser, - provisioningState, - server, - permissions, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + path is null || fileSystemUser is null || provisioningState is null || server is null || permissions is null ? default : new BucketPatchProperties( + path, + fileSystemUser, + provisioningState, + server, + permissions, + new Dictionary())); } - /// Initializes a new instance of . + /// Bucket Access Key, Secret Key, and Expiry date and time of the key pair. /// The Access Key that is required along with the Secret Key to access the bucket. /// The Secret Key that is required along with the Access Key to access the bucket. /// The bucket's Access and Secret key pair expiry date and time (in UTC). - /// A new instance for mocking. - public static NetAppBucketGenerateCredentials NetAppBucketGenerateCredentials(string accessKey = null, string secretKey = null, DateTimeOffset? keyPairExpiry = null) + /// A new instance for mocking. + public static BucketGenerateCredentials BucketGenerateCredentials(string accessKey = default, string secretKey = default, DateTimeOffset? keyPairExpiry = default) { - return new NetAppBucketGenerateCredentials(accessKey, secretKey, keyPairExpiry, serializedAdditionalRawData: null); + return new BucketGenerateCredentials(accessKey, secretKey, keyPairExpiry, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// The identity used for the resource. - /// Azure lifecycle management. - /// Active Directories. - /// Encryption settings. - /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. - /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. - /// MultiAD Status for the account. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppAccountData NetAppAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ManagedServiceIdentity identity, string provisioningState, IEnumerable activeDirectories, NetAppAccountEncryption encryption, bool? disableShowmount, string nfsV4IdDomain, MultiAdStatus? multiAdStatus) + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + /// The availability zones. + /// A new instance for mocking. + public static CacheData CacheData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, CacheProperties properties = default, string etag = default, IEnumerable zones = default) { - return NetAppAccountData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, etag: etag, identity: identity, provisioningState: provisioningState, activeDirectories: activeDirectories, encryption: encryption, disableShowmount: disableShowmount, nfsV4IdDomain: nfsV4IdDomain, multiAdStatus: multiAdStatus, ldapConfiguration: default); - } + tags ??= new ChangeTrackingDictionary(); + zones ??= new ChangeTrackingList(); - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The identity used for the resource. - /// Azure lifecycle management. - /// Active Directories. - /// Encryption settings. - /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. - /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. - /// MultiAD Status for the account. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppAccountPatch NetAppAccountPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, string provisioningState, IEnumerable activeDirectories, NetAppAccountEncryption encryption, bool? disableShowmount, string nfsV4IdDomain, MultiAdStatus? multiAdStatus) - { - return NetAppAccountPatch(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, identity: identity, provisioningState: provisioningState, activeDirectories: activeDirectories, encryption: encryption, disableShowmount: disableShowmount, nfsV4IdDomain: nfsV4IdDomain, multiAdStatus: multiAdStatus, ldapConfiguration: default); + return new CacheData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + properties, + etag, + zones.ToList()); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. + /// Cache resource properties. + /// The file path of the cache. + /// Maximum storage quota allowed for a file system in bytes. Valid values are in the range 50GiB to 1PiB. Values expressed in bytes as multiples of 1GiB. + /// Set of export policy rules. /// Set of protocol types, default NFSv3, CIFS for SMB protocol. /// Azure lifecycle management. - /// Resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// Resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// The original value of the network features type available to the volume at the time it was created. - /// The effective value of the network features type available to the volume, or current effective state of update. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - /// DataProtection type volumes include an object containing details of the replication. - /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. + /// Azure NetApp Files Cache lifecycle management. + /// The Azure Resource URI for a delegated cache subnet that will be used to allocate data IPs. + /// The Azure Resource URI for a delegated subnet that will be used for ANF Intercluster Interface IP addresses. + /// List of mount targets that can be used to mount this cache. + /// Describe if a cache is Kerberos enabled. + /// SMB information for the cache. + /// Maximum throughput in MiB/s that can be achieved by this cache volume and this will be accepted as input only for manual qosType cache. /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. + /// Source of key used to encrypt data in the cache. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// Space shared by short term clone volume with parent volume in bytes. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeData NetAppVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, IEnumerable zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, NetAppNetworkFeature? effectiveNetworkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IEnumerable mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, CoolAccessTieringPolicy? coolAccessTieringPolicy, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IEnumerable dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IEnumerable placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId, long? inheritedSizeInBytes) - { - return NetAppVolumeData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, etag: etag, zones: zones, fileSystemId: fileSystemId, creationToken: creationToken, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, provisioningState: provisioningState, snapshotId: snapshotId, deleteBaseSnapshot: deleteBaseSnapshot, backupId: backupId, baremetalTenantId: baremetalTenantId, subnetId: subnetId, networkFeatures: networkFeatures, effectiveNetworkFeatures: effectiveNetworkFeatures, networkSiblingSetId: networkSiblingSetId, storageToNetworkProximity: storageToNetworkProximity, mountTargets: mountTargets, volumeType: volumeType, dataProtection: dataProtection, acceptGrowCapacityPoolForShortTermCloneSplit: acceptGrowCapacityPoolForShortTermCloneSplit, isRestoring: isRestoring, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, isKerberosEnabled: isKerberosEnabled, securityStyle: securityStyle, isSmbEncryptionEnabled: isSmbEncryptionEnabled, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable, isSmbContinuouslyAvailable: isSmbContinuouslyAvailable, throughputMibps: throughputMibps, actualThroughputMibps: actualThroughputMibps, encryptionKeySource: encryptionKeySource, keyVaultPrivateEndpointResourceId: keyVaultPrivateEndpointResourceId, isLdapEnabled: isLdapEnabled, ldapServerType: default, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: coolAccessRetrievalPolicy, coolAccessTieringPolicy: coolAccessTieringPolicy, unixPermissions: unixPermissions, cloneProgress: cloneProgress, fileAccessLogs: fileAccessLogs, avsDataStore: avsDataStore, dataStoreResourceId: dataStoreResourceId, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, maximumNumberOfFiles: maximumNumberOfFiles, volumeGroupName: volumeGroupName, capacityPoolResourceId: capacityPoolResourceId, proximityPlacementGroupId: proximityPlacementGroupId, t2Network: t2Network, volumeSpecName: volumeSpecName, isEncrypted: isEncrypted, placementRules: placementRules, enableSubvolumes: enableSubvolumes, provisionedAvailabilityZone: provisionedAvailabilityZone, isLargeVolume: isLargeVolume, originatingResourceId: originatingResourceId, inheritedSizeInBytes: inheritedSizeInBytes, language: default); + /// Maximum number of files allowed. + /// Specifies if the cache is encryption or not. + /// Language supported for volume. + /// Specifies whether LDAP is enabled or not for flexcache volume. + /// Specifies the type of LDAP server for flexcache volume. + /// Origin cluster information. + /// Flag indicating whether a CIFS change notification is enabled for the cache. + /// Flag indicating whether the global file lock is enabled for the cache. + /// Flag indicating whether writeback is enabled for the cache. + /// A new instance for mocking. + public static CacheProperties CacheProperties(string filepath = default, long size = default, IEnumerable exportPolicy = default, IEnumerable protocolTypes = default, CacheProvisioningState? provisioningState = default, CacheLifeCycleState? cacheState = default, ResourceIdentifier cacheSubnetResourceId = default, ResourceIdentifier peeringSubnetResourceId = default, IEnumerable mountTargets = default, KerberosState? kerberos = default, SmbSettings smbSettings = default, float? throughputMibps = default, float? actualThroughputMibps = default, EncryptionKeySource encryptionKeySource = default, ResourceIdentifier keyVaultPrivateEndpointResourceId = default, long? maximumNumberOfFiles = default, EncryptionState? encryption = default, VolumeLanguage? language = default, LdapState? ldap = default, LdapServerType? ldapServerType = default, OriginClusterInformation originClusterInformation = default, CifsChangeNotifyState? cifsChangeNotifications = default, GlobalFileLockingState? globalFileLocking = default, EnableWriteBackState? writeBack = default) + { + exportPolicy ??= new ChangeTrackingList(); + protocolTypes ??= new ChangeTrackingList(); + mountTargets ??= new ChangeTrackingList(); + + return new CacheProperties( + filepath, + size, + exportPolicy.ToList(), + protocolTypes.ToList(), + provisioningState, + cacheState, + cacheSubnetResourceId, + peeringSubnetResourceId, + mountTargets.ToList(), + kerberos, + smbSettings, + throughputMibps, + actualThroughputMibps, + encryptionKeySource, + keyVaultPrivateEndpointResourceId, + maximumNumberOfFiles, + encryption, + language, + ldap, + ldapServerType, + originClusterInformation, + cifsChangeNotifications, + globalFileLocking, + writeBack, + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Id. - /// Indicates whether the local volume is the source or destination for the Volume Replication. - /// Schedule. - /// The resource ID of the remote volume. Required for cross region and cross zone replication. - /// The full path to a volume that is to be migrated into ANF. Required for Migration volumes. - /// The remote region for the other end of the Volume Replication. - /// A list of destination replications. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppReplicationObject NetAppReplicationObject(string replicationId, NetAppEndpointType? endpointType, NetAppReplicationSchedule? replicationSchedule, ResourceIdentifier remoteVolumeResourceId, RemotePath remotePath, string remoteVolumeRegion, IEnumerable destinationReplications) + /// Contains all the information needed to mount a cache. + /// UUID v4 used to identify the MountTarget. + /// The mount target's IPv4 address, used to mount the cache. + /// The SMB server's Fully Qualified Domain Name, FQDN. + /// A new instance for mocking. + public static CacheMountTargetProperties CacheMountTargetProperties(string mountTargetId = default, IPAddress ipAddress = default, string smbServerFqdn = default) { - return NetAppReplicationObject(replicationId: replicationId, endpointType: endpointType, replicationSchedule: replicationSchedule, remoteVolumeResourceId: remoteVolumeResourceId, remotePath: remotePath, remoteVolumeRegion: remoteVolumeRegion, destinationReplications: destinationReplications, externalReplicationSetupStatus: default, externalReplicationSetupInfo: default, mirrorState: default, relationshipStatus: default); + return new CacheMountTargetProperties(mountTargetId, ipAddress, smbServerFqdn, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Resource Id. - /// Resource name. - /// Resource type. - /// Resource tags. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - /// Azure lifecycle management. - /// Resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// Resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// The original value of the network features type available to the volume at the time it was created. - /// The effective value of the network features type available to the volume, or current effective state of update. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - /// DataProtection type volumes include an object containing details of the replication. - /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// Space shared by short term clone volume with parent volume in bytes. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeGroupVolume NetAppVolumeGroupVolume(ResourceIdentifier id, string name, ResourceType? resourceType, IDictionary tags, IEnumerable zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, NetAppNetworkFeature? effectiveNetworkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IEnumerable mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, CoolAccessTieringPolicy? coolAccessTieringPolicy, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IEnumerable dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IEnumerable placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId, long? inheritedSizeInBytes) + /// Stores the origin cluster information associated to a cache. + /// ONTAP cluster name of external cluster hosting the origin volume. + /// ONTAP Intercluster LIF IP addresses. One IP address per cluster node is required. + /// External Vserver (SVM) name name of the SVM hosting the origin volume. + /// External origin volume name associated to this cache. + /// A new instance for mocking. + public static OriginClusterInformation OriginClusterInformation(string peerClusterName = default, IEnumerable peerAddresses = default, string peerVserverName = default, string peerVolumeName = default) { - return NetAppVolumeGroupVolume(id: id, name: name, resourceType: resourceType, tags: tags, zones: zones, fileSystemId: fileSystemId, creationToken: creationToken, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, provisioningState: provisioningState, snapshotId: snapshotId, deleteBaseSnapshot: deleteBaseSnapshot, backupId: backupId, baremetalTenantId: baremetalTenantId, subnetId: subnetId, networkFeatures: networkFeatures, effectiveNetworkFeatures: effectiveNetworkFeatures, networkSiblingSetId: networkSiblingSetId, storageToNetworkProximity: storageToNetworkProximity, mountTargets: mountTargets, volumeType: volumeType, dataProtection: dataProtection, acceptGrowCapacityPoolForShortTermCloneSplit: acceptGrowCapacityPoolForShortTermCloneSplit, isRestoring: isRestoring, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, isKerberosEnabled: isKerberosEnabled, securityStyle: securityStyle, isSmbEncryptionEnabled: isSmbEncryptionEnabled, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable, isSmbContinuouslyAvailable: isSmbContinuouslyAvailable, throughputMibps: throughputMibps, actualThroughputMibps: actualThroughputMibps, encryptionKeySource: encryptionKeySource, keyVaultPrivateEndpointResourceId: keyVaultPrivateEndpointResourceId, isLdapEnabled: isLdapEnabled, ldapServerType: default, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: coolAccessRetrievalPolicy, coolAccessTieringPolicy: coolAccessTieringPolicy, unixPermissions: unixPermissions, cloneProgress: cloneProgress, fileAccessLogs: fileAccessLogs, avsDataStore: avsDataStore, dataStoreResourceId: dataStoreResourceId, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, maximumNumberOfFiles: maximumNumberOfFiles, volumeGroupName: volumeGroupName, capacityPoolResourceId: capacityPoolResourceId, proximityPlacementGroupId: proximityPlacementGroupId, t2Network: t2Network, volumeSpecName: volumeSpecName, isEncrypted: isEncrypted, placementRules: placementRules, enableSubvolumes: enableSubvolumes, provisionedAvailabilityZone: provisionedAvailabilityZone, isLargeVolume: isLargeVolume, originatingResourceId: originatingResourceId, inheritedSizeInBytes: inheritedSizeInBytes, language: default); + peerAddresses ??= new ChangeTrackingList(); + + return new OriginClusterInformation(peerClusterName, peerAddresses.ToList(), peerVserverName, peerVolumeName, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// UUID v4 used to identify the Pool. - /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). - /// The service level of the file system. - /// Azure lifecycle management. - /// Total throughput of pool in MiB/s. - /// Utilized throughput of pool in MiB/s. - /// The qos type of the pool. - /// If enabled (true) the pool can contain cool Access enabled volumes. - /// Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static CapacityPoolData CapacityPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, Guid? poolId, long size, NetAppFileServiceLevel serviceLevel, string provisioningState, float? totalThroughputMibps, float? utilizedThroughputMibps, CapacityPoolQosType? qosType, bool? isCoolAccessEnabled, CapacityPoolEncryptionType? encryptionType) + /// The type used for update operations of the Cache. + /// Resource tags. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static CachePatch CachePatch(IDictionary tags = default, CacheUpdateProperties properties = default) { - return CapacityPoolData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, etag: etag, poolId: poolId, size: size, serviceLevel: serviceLevel, provisioningState: provisioningState, totalThroughputMibps: totalThroughputMibps, utilizedThroughputMibps: utilizedThroughputMibps, customThroughputMibps: default, qosType: qosType, isCoolAccessEnabled: isCoolAccessEnabled, encryptionType: encryptionType); + tags ??= new ChangeTrackingDictionary(); + + return new CachePatch(tags, properties, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). - /// The qos type of the pool. - /// If enabled (true) the pool can contain cool Access enabled volumes. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static CapacityPoolPatch CapacityPoolPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, long? size, CapacityPoolQosType? qosType, bool? isCoolAccessEnabled) - { - return CapacityPoolPatch(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, size: size, qosType: qosType, isCoolAccessEnabled: isCoolAccessEnabled, customThroughputMibps: default); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. + /// The updatable properties of the Cache. + /// Maximum storage quota allowed for a file system in bytes. Valid values are in the range 50GiB to 1PiB. Values expressed in bytes as multiples of 1GiB. + /// Set of export policy rules. /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - /// Azure lifecycle management. - /// Resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// Resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// The original value of the network features type available to the volume at the time it was created. - /// The effective value of the network features type available to the volume, or current effective state of update. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - /// DataProtection type volumes include an object containing details of the replication. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. + /// SMB information for the cache. + /// Maximum throughput in MiB/s that can be achieved by this cache volume and this will be accepted as input only for manual qosType cache. /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeData NetAppVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, IEnumerable zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, NetAppNetworkFeature? effectiveNetworkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IEnumerable mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, CoolAccessTieringPolicy? coolAccessTieringPolicy, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IEnumerable dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IEnumerable placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId) + /// Flag indicating whether a CIFS change notification is enabled for the cache. + /// Flag indicating whether the global file lock is enabled for the cache. + /// Flag indicating whether writeback is enabled for the cache. + /// A new instance for mocking. + public static CacheUpdateProperties CacheUpdateProperties(long? size = default, IEnumerable exportPolicy = default, IEnumerable protocolTypes = default, SmbSettings smbSettings = default, float? throughputMibps = default, ResourceIdentifier keyVaultPrivateEndpointResourceId = default, CifsChangeNotifyState? cifsChangeNotifications = default, GlobalFileLockingState? globalFileLocking = default, EnableWriteBackState? writeBack = default) + { + exportPolicy ??= new ChangeTrackingList(); + protocolTypes ??= new ChangeTrackingList(); + + return new CacheUpdateProperties( + size, + exportPolicy.ToList(), + protocolTypes.ToList(), + smbSettings, + throughputMibps, + keyVaultPrivateEndpointResourceId, + cifsChangeNotifications, + globalFileLocking, + writeBack, + additionalBinaryDataProperties: null); + } + + /// The response containing peering passphrases and commands for cluster and vserver peering. + /// The cluster peering command. + /// The cluster peering passphrase. + /// The vserver peering command. + /// A new instance for mocking. + public static PeeringPassphrases PeeringPassphrases(string clusterPeeringCommand = default, string clusterPeeringPassphrase = default, string vserverPeeringCommand = default) { - return NetAppVolumeData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, etag: etag, zones: zones, fileSystemId: fileSystemId, creationToken: creationToken, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, provisioningState: provisioningState, snapshotId: snapshotId, deleteBaseSnapshot: deleteBaseSnapshot, backupId: backupId, baremetalTenantId: baremetalTenantId, subnetId: subnetId, networkFeatures: networkFeatures, effectiveNetworkFeatures: effectiveNetworkFeatures, networkSiblingSetId: networkSiblingSetId, storageToNetworkProximity: storageToNetworkProximity, mountTargets: mountTargets, volumeType: volumeType, dataProtection: dataProtection, acceptGrowCapacityPoolForShortTermCloneSplit: default, isRestoring: isRestoring, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, isKerberosEnabled: isKerberosEnabled, securityStyle: securityStyle, isSmbEncryptionEnabled: isSmbEncryptionEnabled, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable, isSmbContinuouslyAvailable: isSmbContinuouslyAvailable, throughputMibps: throughputMibps, actualThroughputMibps: actualThroughputMibps, encryptionKeySource: encryptionKeySource, keyVaultPrivateEndpointResourceId: keyVaultPrivateEndpointResourceId, isLdapEnabled: isLdapEnabled, ldapServerType: default, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: coolAccessRetrievalPolicy, coolAccessTieringPolicy: coolAccessTieringPolicy, unixPermissions: unixPermissions, cloneProgress: cloneProgress, fileAccessLogs: fileAccessLogs, avsDataStore: avsDataStore, dataStoreResourceId: dataStoreResourceId, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, maximumNumberOfFiles: maximumNumberOfFiles, volumeGroupName: volumeGroupName, capacityPoolResourceId: capacityPoolResourceId, proximityPlacementGroupId: proximityPlacementGroupId, t2Network: t2Network, volumeSpecName: volumeSpecName, isEncrypted: isEncrypted, placementRules: placementRules, enableSubvolumes: enableSubvolumes, provisionedAvailabilityZone: provisionedAvailabilityZone, isLargeVolume: isLargeVolume, originatingResourceId: originatingResourceId, inheritedSizeInBytes: default, language: default); + return new PeeringPassphrases(clusterPeeringCommand, clusterPeeringPassphrase, vserverPeeringCommand, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Resource Id. - /// Resource name. - /// Resource type. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// Resource tags. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - /// Azure lifecycle management. - /// Resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// Resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// The original value of the network features type available to the volume at the time it was created. - /// The effective value of the network features type available to the volume, or current effective state of update. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - /// DataProtection type volumes include an object containing details of the replication. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeGroupVolume NetAppVolumeGroupVolume(ResourceIdentifier id, string name, ResourceType? resourceType, IDictionary tags, IEnumerable zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, NetAppNetworkFeature? effectiveNetworkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IEnumerable mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, CoolAccessTieringPolicy? coolAccessTieringPolicy, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IEnumerable dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IEnumerable placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId) + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The managed service identities assigned to this resource. + /// A new instance for mocking. + public static ElasticAccountData ElasticAccountData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, ElasticAccountProperties properties = default, string etag = default, ManagedServiceIdentity identity = default) { - return NetAppVolumeGroupVolume(id: id, name: name, resourceType: resourceType, tags: tags, zones: zones, fileSystemId: fileSystemId, creationToken: creationToken, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, provisioningState: provisioningState, snapshotId: snapshotId, deleteBaseSnapshot: deleteBaseSnapshot, backupId: backupId, baremetalTenantId: baremetalTenantId, subnetId: subnetId, networkFeatures: networkFeatures, effectiveNetworkFeatures: effectiveNetworkFeatures, networkSiblingSetId: networkSiblingSetId, storageToNetworkProximity: storageToNetworkProximity, mountTargets: mountTargets, volumeType: volumeType, dataProtection: dataProtection, acceptGrowCapacityPoolForShortTermCloneSplit: default, isRestoring: isRestoring, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, isKerberosEnabled: isKerberosEnabled, securityStyle: securityStyle, isSmbEncryptionEnabled: isSmbEncryptionEnabled, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable, isSmbContinuouslyAvailable: isSmbContinuouslyAvailable, throughputMibps: throughputMibps, actualThroughputMibps: actualThroughputMibps, encryptionKeySource: encryptionKeySource, keyVaultPrivateEndpointResourceId: keyVaultPrivateEndpointResourceId, isLdapEnabled: isLdapEnabled, ldapServerType: default, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: coolAccessRetrievalPolicy, coolAccessTieringPolicy: coolAccessTieringPolicy, unixPermissions: unixPermissions, cloneProgress: cloneProgress, fileAccessLogs: fileAccessLogs, avsDataStore: avsDataStore, dataStoreResourceId: dataStoreResourceId, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, maximumNumberOfFiles: maximumNumberOfFiles, volumeGroupName: volumeGroupName, capacityPoolResourceId: capacityPoolResourceId, proximityPlacementGroupId: proximityPlacementGroupId, t2Network: t2Network, volumeSpecName: volumeSpecName, isEncrypted: isEncrypted, placementRules: placementRules, enableSubvolumes: enableSubvolumes, provisionedAvailabilityZone: provisionedAvailabilityZone, isLargeVolume: isLargeVolume, originatingResourceId: originatingResourceId, inheritedSizeInBytes: default, language: default); + tags ??= new ChangeTrackingDictionary(); + + return new ElasticAccountData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + properties, + etag, + identity); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// The identity used for the resource. + /// NetApp elastic account properties. /// Azure lifecycle management. - /// Active Directories. /// Encryption settings. - /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppAccountData NetAppAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ManagedServiceIdentity identity, string provisioningState, IEnumerable activeDirectories, NetAppAccountEncryption encryption, bool? disableShowmount) + /// A new instance for mocking. + public static ElasticAccountProperties ElasticAccountProperties(Models.NetAppProvisioningState? provisioningState = default, ElasticEncryption encryption = default) { - return NetAppAccountData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, etag: etag, identity: identity, provisioningState: provisioningState, activeDirectories: activeDirectories, encryption: encryption, disableShowmount: disableShowmount, nfsV4IdDomain: default, multiAdStatus: default, ldapConfiguration: default); + return new ElasticAccountProperties(provisioningState, encryption, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Identity used to authenticate with key vault. /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. /// The ARM resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppEncryptionIdentity NetAppEncryptionIdentity(string principalId, string userAssignedIdentity) + /// A new instance for mocking. + public static ElasticEncryptionIdentity ElasticEncryptionIdentity(string principalId = default, ResourceIdentifier userAssignedIdentity = default) { - return NetAppEncryptionIdentity(principalId: principalId, userAssignedIdentity: userAssignedIdentity, federatedClientId: default); + return new ElasticEncryptionIdentity(principalId, userAssignedIdentity, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The identity used for the resource. - /// Azure lifecycle management. - /// Active Directories. - /// Encryption settings. - /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppAccountPatch NetAppAccountPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, string provisioningState, IEnumerable activeDirectories, NetAppAccountEncryption encryption, bool? disableShowmount) + /// The managed service identities assigned to this resource. + /// Resource tags. + /// Encryption settings. + /// A new instance for mocking. + public static ElasticAccountPatch ElasticAccountPatch(ManagedServiceIdentity identity = default, IDictionary tags = default, ElasticEncryption elasticAccountUpdateEncryption = default) { - return NetAppAccountPatch(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, identity: identity, provisioningState: provisioningState, activeDirectories: activeDirectories, encryption: encryption, disableShowmount: disableShowmount, nfsV4IdDomain: default, multiAdStatus: default, ldapConfiguration: default); + tags ??= new ChangeTrackingDictionary(); + + return new ElasticAccountPatch(identity, tags, elasticAccountUpdateEncryption is null ? default : new ElasticAccountUpdateProperties(elasticAccountUpdateEncryption, new Dictionary()), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Id. - /// Indicates whether the local volume is the source or destination for the Volume Replication. - /// Schedule. - /// The resource ID of the remote volume. Required for cross region and cross zone replication. - /// The full path to a volume that is to be migrated into ANF. Required for Migration volumes. - /// The remote region for the other end of the Volume Replication. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppReplicationObject NetAppReplicationObject(string replicationId, NetAppEndpointType? endpointType, NetAppReplicationSchedule? replicationSchedule, ResourceIdentifier remoteVolumeResourceId, RemotePath remotePath, string remoteVolumeRegion) + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The availability zones. + /// A new instance for mocking. + public static ElasticCapacityPoolData ElasticCapacityPoolData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, ElasticCapacityPoolProperties properties = default, string etag = default, IEnumerable zones = default) { - return NetAppReplicationObject(replicationId: replicationId, endpointType: endpointType, replicationSchedule: replicationSchedule, remoteVolumeResourceId: remoteVolumeResourceId, remotePath: remotePath, remoteVolumeRegion: remoteVolumeRegion, destinationReplications: default, externalReplicationSetupStatus: default, externalReplicationSetupInfo: default, mirrorState: default, relationshipStatus: default); - } + tags ??= new ChangeTrackingDictionary(); + zones ??= new ChangeTrackingList(); - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// UUID v4 used to identify the Backup. - /// The creation date of the backup. - /// Azure lifecycle management. - /// Size of backup in bytes. - /// Label for backup. + return new ElasticCapacityPoolData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + properties, + etag, + zones.ToList()); + } + + /// Elastic capacity pool properties. + /// Provisioned size of the pool (in bytes). For zoneRedundant service level pool, value must be in the range 1TiB to 16TiB or 1TiB to 128TiB for supported region. Values expressed in bytes as multiples of 1TiB till 16TiB and in multiples of 8TiB from 24TiB to 128TiB. Pool size can't be shrunk once it is created. + /// The service level of the elastic capacity pool. + /// Azure lifecycle management. + /// Encryption settings. + /// Total throughput of the pool in MiB/s. + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/elasticVolumes, this is used by all the volumes within the pool. + /// Indicates the current zone of the pool. This can be changed for zoneRedundant service level pool with the changeZone action. + /// Current availability status of the resource. + /// The Azure Resource URI for an Active Directory configuration. This is used by all the SMB volumes within the pool. + /// A new instance for mocking. + public static ElasticCapacityPoolProperties ElasticCapacityPoolProperties(long size = default, ElasticServiceLevel serviceLevel = default, Models.NetAppProvisioningState? provisioningState = default, ElasticEncryptionConfiguration encryption = default, double? totalThroughputMibps = default, ResourceIdentifier subnetResourceId = default, string currentZone = default, ElasticResourceAvailabilityStatus? availabilityStatus = default, ResourceIdentifier activeDirectoryConfigResourceId = default) + { + return new ElasticCapacityPoolProperties( + size, + serviceLevel, + provisioningState, + encryption, + totalThroughputMibps, + subnetResourceId, + currentZone, + availabilityStatus, + activeDirectoryConfigResourceId, + additionalBinaryDataProperties: null); + } + + /// The type used for update operations of the ElasticCapacityPool. + /// Resource tags. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ElasticCapacityPoolPatch ElasticCapacityPoolPatch(IDictionary tags = default, ElasticCapacityPoolUpdateProperties properties = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new ElasticCapacityPoolPatch(tags, properties, additionalBinaryDataProperties: null); + } + + /// Changes the zone for the Zone Redundant elastic capacity pool. + /// Availability zone to move Zone Redundant elastic capacity pool to. + /// A new instance for mocking. + public static ChangeZoneRequest ChangeZoneRequest(string newZone = default) + { + return new ChangeZoneRequest(newZone, additionalBinaryDataProperties: null); + } + + /// File path availability request content - availability is based on the elastic volume filePath within the given elastic capacityPool. + /// A unique file path for the volume. Used when creating mount targets. This needs to be unique within the elastic capacity pool. + /// A new instance for mocking. + public static CheckElasticVolumeFilePathAvailabilityRequest CheckElasticVolumeFilePathAvailabilityRequest(string filePath = default) + { + return new CheckElasticVolumeFilePathAvailabilityRequest(filePath, additionalBinaryDataProperties: null); + } + + /// Information regarding availability of a resource. + /// True indicates name is valid and available. False indicates the name is invalid, unavailable, or both. + /// Invalid indicates the name provided does not match Azure NetApp Files naming requirements. AlreadyExists indicates that the name is already in use and is therefore unavailable. + /// If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. + /// A new instance for mocking. + public static CheckElasticResourceAvailabilityResult CheckElasticResourceAvailabilityResult(CheckElasticResourceAvailabilityStatus? isAvailable = default, CheckElasticResourceAvailabilityReason? reason = default, string message = default) + { + return new CheckElasticResourceAvailabilityResult(isAvailable, reason, message, additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The availability zones. + /// A new instance for mocking. + public static ElasticVolumeData ElasticVolumeData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, ElasticVolumeProperties properties = default, string etag = default, IEnumerable zones = default) + { + tags ??= new ChangeTrackingDictionary(); + zones ??= new ChangeTrackingList(); + + return new ElasticVolumeData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + properties, + etag, + zones.ToList()); + } + + /// A unique file path for the volume. Used when creating mount targets. This needs to be unique within the elastic capacity pool. + /// Maximum size allowed for a volume in bytes. Valid values are in the range 1GiB to 16TiB. Values expressed in bytes as multiples of 1 GiB. + /// Export policy rule. + /// Set of support protocol types for the elastic volume. + /// Azure lifecycle management. + /// Current availability status of the resource. + /// Resource identifier used to identify the Elastic Snapshot. + /// List of mount targets that can be used to mount this volume. + /// Data protection configuration option for the volume, including snapshot policies and backup. + /// Controls the visibility of the volume's read-only snapshot directory, which provides access to each of the volume's snapshots. + /// Used to enable or disable encryption for in-flight SMB data volume. This flag can be modified during Elastic volume update operation as well. Only applicable for SMB protocol Elastic volumes. + /// Resource identifier used to identify the Elastic Backup. + /// The current state of the restoration process. + /// A new instance for mocking. + public static ElasticVolumeProperties ElasticVolumeProperties(string filePath = default, long size = default, IList exportRules = default, IEnumerable protocolTypes = default, Models.NetAppProvisioningState? provisioningState = default, ElasticResourceAvailabilityStatus? availabilityStatus = default, ResourceIdentifier snapshotResourceId = default, IEnumerable mountTargets = default, ElasticVolumeDataProtectionProperties dataProtection = default, SnapshotDirectoryVisibility? snapshotDirectoryVisibility = default, ElasticSmbEncryption? smbEncryption = default, ResourceIdentifier backupResourceId = default, ElasticVolumeRestorationState? restorationState = default) + { + protocolTypes ??= new ChangeTrackingList(); + mountTargets ??= new ChangeTrackingList(); + + return new ElasticVolumeProperties( + filePath, + size, + exportRules is null ? default : new ElasticExportPolicy(exportRules, new Dictionary()), + protocolTypes.ToList(), + provisioningState, + availabilityStatus, + snapshotResourceId, + mountTargets.ToList(), + dataProtection, + snapshotDirectoryVisibility, + smbEncryption is null ? default : new ElasticSmbProperties(smbEncryption, new Dictionary()), + backupResourceId, + restorationState, + additionalBinaryDataProperties: null); + } + + /// Elastic Volume Export Policy Rule. + /// Controls the priority of the export policy rule. When connecting to the volume the rule with the lowest index that applies to the connecting client is used. + /// Specifies the Unix file access level for the volume. It encompasses both read-only and read-write permissions. Additionally, NoAccess can be set to block all access to the volume. + /// Allows clients to access the volume with the NFSv3 protocol. Enable only for NFSv3 type volumes. + /// Allows clients to access the volume with at least NFSv4.1 protocol. + /// Client ingress specification for the export policy as list of IPv4 CIDRs, IPv4 host addresses and host names. + /// Indicates whether root access to the volume is granted to clients affected by this rule. + /// A new instance for mocking. + public static ElasticExportPolicyRule ElasticExportPolicyRule(int? ruleIndex = default, ElasticUnixAccessRule? unixAccessRule = default, ElasticNfsv3Access? nfsv3 = default, ElasticNfsv4Access? nfsv4 = default, IEnumerable allowedClients = default, ElasticRootAccess? rootAccess = default) + { + allowedClients ??= new ChangeTrackingList(); + + return new ElasticExportPolicyRule( + ruleIndex, + unixAccessRule, + nfsv3, + nfsv4, + allowedClients.ToList(), + rootAccess, + additionalBinaryDataProperties: null); + } + + /// Contains all the information needed to mount an elastic volume. + /// The mount target's IPv4 address, used to mount the volume. + /// The SMB server's Fully Qualified Domain Name, FQDN. + /// A new instance for mocking. + public static ElasticMountTargetProperties ElasticMountTargetProperties(IPAddress ipAddress = default, string smbServerFqdn = default) + { + return new ElasticMountTargetProperties(ipAddress, smbServerFqdn, additionalBinaryDataProperties: null); + } + + /// The type used for update operations of the ElasticVolume. + /// Resource tags. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ElasticVolumePatch ElasticVolumePatch(IDictionary tags = default, ElasticVolumeUpdateProperties properties = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new ElasticVolumePatch(tags, properties, additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Azure lifecycle management. + /// A new instance for mocking. + public static ElasticSnapshotData ElasticSnapshotData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, Models.NetAppProvisioningState? elasticSnapshotProvisioningState = default) + { + return new ElasticSnapshotData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + elasticSnapshotProvisioningState is null ? default : new ElasticSnapshotProperties(elasticSnapshotProvisioningState, new Dictionary())); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// A new instance for mocking. + public static ElasticSnapshotPolicyData ElasticSnapshotPolicyData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, ElasticSnapshotPolicyProperties properties = default, string etag = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new ElasticSnapshotPolicyData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + properties, + etag); + } + + /// Elastic Snapshot policy properties. + /// Schedule for hourly snapshots. + /// Schedule for daily snapshots. + /// Schedule for weekly snapshots. + /// Schedule for monthly snapshots. + /// Configures if the snapshot policy is enabled on the volumes connected to the policy. + /// Azure lifecycle management. + /// A new instance for mocking. + public static ElasticSnapshotPolicyProperties ElasticSnapshotPolicyProperties(ElasticSnapshotPolicyHourlySchedule hourlySchedule = default, ElasticSnapshotPolicyDailySchedule dailySchedule = default, ElasticSnapshotPolicyWeeklySchedule weeklySchedule = default, ElasticSnapshotPolicyMonthlySchedule monthlySchedule = default, PolicyStatus? policyStatus = default, Models.NetAppProvisioningState? provisioningState = default) + { + return new ElasticSnapshotPolicyProperties( + hourlySchedule, + dailySchedule, + weeklySchedule, + monthlySchedule, + policyStatus, + provisioningState, + additionalBinaryDataProperties: null); + } + + /// Weekly Schedule properties used to create NetApp snapshot policy. + /// Weekly snapshot count to keep. + /// Indicates which weekday(s) snapshot(s) should be taken, accepts a list of week day names in english. + /// Indicates which hour in UTC timezone a snapshot should be taken. + /// Indicates which minute snapshot should be taken. + /// A new instance for mocking. + public static ElasticSnapshotPolicyWeeklySchedule ElasticSnapshotPolicyWeeklySchedule(int? snapshotsToKeep = default, IEnumerable days = default, int? hour = default, int? minute = default) + { + days ??= new ChangeTrackingList(); + + return new ElasticSnapshotPolicyWeeklySchedule(snapshotsToKeep, days.ToList(), hour, minute, additionalBinaryDataProperties: null); + } + + /// Monthly Schedule properties used to create NetApp snapshot policy. + /// Monthly snapshot count to keep. + /// Indicates which days of the month snapshot (1-31) should be taken, accepts a list of integers. + /// Indicates which hour in UTC timezone a snapshot should be taken. + /// Indicates which minute snapshot should be taken. + /// A new instance for mocking. + public static ElasticSnapshotPolicyMonthlySchedule ElasticSnapshotPolicyMonthlySchedule(int? snapshotsToKeep = default, IEnumerable daysOfMonth = default, int? hour = default, int? minute = default) + { + daysOfMonth ??= new ChangeTrackingList(); + + return new ElasticSnapshotPolicyMonthlySchedule(snapshotsToKeep, daysOfMonth.ToList(), hour, minute, additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// Azure lifecycle management. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// A new instance for mocking. + public static ElasticBackupVaultData ElasticBackupVaultData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, Models.NetAppProvisioningState? elasticBackupVaultProvisioningState = default, string etag = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new ElasticBackupVaultData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + elasticBackupVaultProvisioningState is null ? default : new ElasticBackupVaultProperties(elasticBackupVaultProvisioningState, new Dictionary()), + etag); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// A new instance for mocking. + public static ElasticBackupPolicyData ElasticBackupPolicyData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, ElasticBackupPolicyProperties properties = default, string etag = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new ElasticBackupPolicyData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + properties, + etag); + } + + /// Elastic Backup Policy properties. + /// Azure lifecycle management. + /// Daily backups count to keep. + /// Weekly backups count to keep. + /// Monthly backups count to keep. + /// The number of volumes currently using this backup policy. + /// The property to identify whether backup policy is enabled or not. + /// A new instance for mocking. + public static ElasticBackupPolicyProperties ElasticBackupPolicyProperties(Models.NetAppProvisioningState? provisioningState = default, int? dailyBackupsToKeep = default, int? weeklyBackupsToKeep = default, int? monthlyBackupsToKeep = default, int? assignedVolumesCount = default, PolicyState? policyState = default) + { + return new ElasticBackupPolicyProperties( + provisioningState, + dailyBackupsToKeep, + weeklyBackupsToKeep, + monthlyBackupsToKeep, + assignedVolumesCount, + policyState, + additionalBinaryDataProperties: null); + } + + /// NetApp Elastic Backup under an elastic Backup Vault. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ElasticBackupData ElasticBackupData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, ElasticBackupProperties properties = default) + { + return new ElasticBackupData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + properties); + } + + /// Elastic Backup properties. + /// The creation date of the backup. + /// The snapshot creation date of the backup. + /// The completion date of the backup. + /// Azure lifecycle management. + /// Size of backup in bytes. + /// Label for backup. /// Type of backup Manual or Scheduled. /// Failure reason. - /// ResourceId used to identify the Volume. - /// Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups. - /// The name of the snapshot. - /// ResourceId used to identify the backup policy. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppBackupData NetAppBackupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string backupId, DateTimeOffset? createdOn, string provisioningState, long? size, string label, NetAppBackupType? backupType, string failureReason, ResourceIdentifier volumeResourceId, bool? useExistingSnapshot, string snapshotName, ResourceIdentifier backupPolicyArmResourceId) + /// ResourceId used to identify the Elastic Volume. + /// Manual backup using an already existing snapshot. This will always be CreateNewSnapshot for scheduled backups and UseExistingSnapshot/CreateNewSnapshot for manual backups. + /// ResourceId used to identify the elastic snapshot resource. This is required when an existing snapshot needs to be used for creating a manual backup. + /// ResourceId used to identify the elastic backup policy. + /// Specifies if the backup is for a large volume. + /// A new instance for mocking. + public static ElasticBackupProperties ElasticBackupProperties(DateTimeOffset? createdOn = default, DateTimeOffset? snapshotCreationOn = default, DateTimeOffset? completionOn = default, Models.NetAppProvisioningState? provisioningState = default, long? size = default, string label = default, ElasticBackupType? backupType = default, string failureReason = default, ResourceIdentifier elasticVolumeResourceId = default, SnapshotUsage? snapshotUsage = default, ResourceIdentifier elasticSnapshotResourceId = default, ResourceIdentifier elasticBackupPolicyResourceId = default, VolumeSize? volumeSize = default) + { + return new ElasticBackupProperties( + createdOn, + snapshotCreationOn, + completionOn, + provisioningState, + size, + label, + backupType, + failureReason, + elasticVolumeResourceId, + snapshotUsage, + elasticSnapshotResourceId, + elasticBackupPolicyResourceId, + volumeSize, + additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + /// The managed service identities assigned to this resource. + /// A new instance for mocking. + public static ActiveDirectoryConfigData ActiveDirectoryConfigData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, ActiveDirectoryConfigProperties properties = default, string etag = default, ManagedServiceIdentity identity = default) { - return NetAppBackupData(id: id, name: name, resourceType: resourceType, systemData: systemData, backupId: backupId, createdOn: createdOn, snapshotCreationOn: default, completionOn: default, provisioningState: provisioningState, size: size, label: label, backupType: backupType, failureReason: failureReason, volumeResourceId: volumeResourceId, useExistingSnapshot: useExistingSnapshot, snapshotName: snapshotName, backupPolicyArmResourceId: backupPolicyArmResourceId, isLargeVolume: default); + tags ??= new ChangeTrackingDictionary(); + + return new ActiveDirectoryConfigData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + properties, + etag, + identity); } - /// Initializes a new instance of NetAppVolumeBackupStatus. - /// Backup health status. - /// Status of the backup mirror relationship. - /// The status of the backup. - /// Reason for the unhealthy backup relationship. - /// Displays error message if the backup is in an error state. - /// Displays the last transfer size. - /// Displays the last transfer type. - /// Displays the total bytes transferred. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeBackupStatus NetAppVolumeBackupStatus(bool? isHealthy, NetAppRelationshipStatus? relationshipStatus, NetAppMirrorState? mirrorState, string unhealthyReason, string errorMessage, long? lastTransferSize, string lastTransferType, long? totalTransferBytes) + /// Active Directory Configuration properties. + /// A domain user account with permission to create machine accounts. + /// An array of DNS server IP addresses(IPv4 only) for the Active Directory. + /// NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. + /// The Organizational Unit (OU) within the Windows Active Directory. + /// The Active Directory site the service will limit Domain Controller discovery to. + /// Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier. + /// Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier. + /// Domain Users in the Active directory to be given SecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. + /// Status of the Active Directory. + /// Azure lifecycle management. + /// Name of the Active Directory domain. + /// Access password from Azure KeyVault Secrets to connect Active Directory. + /// A new instance for mocking. + public static ActiveDirectoryConfigProperties ActiveDirectoryConfigProperties(string userName = default, IEnumerable dns = default, string smbServerName = default, string organizationalUnit = default, string site = default, IEnumerable backupOperators = default, IEnumerable administrators = default, IEnumerable securityOperators = default, ActiveDirectoryStatus? activeDirectoryStatus = default, Models.NetAppProvisioningState? provisioningState = default, string domain = default, SecretPassword secretPassword = default) + { + dns ??= new ChangeTrackingList(); + backupOperators ??= new ChangeTrackingList(); + administrators ??= new ChangeTrackingList(); + securityOperators ??= new ChangeTrackingList(); + + return new ActiveDirectoryConfigProperties( + userName, + dns.ToList(), + smbServerName, + organizationalUnit, + site, + backupOperators.ToList(), + administrators.ToList(), + securityOperators.ToList(), + activeDirectoryStatus, + provisioningState, + domain, + secretPassword, + additionalBinaryDataProperties: null); + } + + /// Identity used to authenticate with key vault. + /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. + /// The Azure resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. + /// A new instance for mocking. + public static SecretPasswordIdentity SecretPasswordIdentity(string principalId = default, string userAssignedIdentity = default) + { + return new SecretPasswordIdentity(principalId, userAssignedIdentity, additionalBinaryDataProperties: null); + } + + /// The type used for update operations of the ActiveDirectoryConfig. + /// The managed service identities assigned to this resource. + /// Resource tags. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ActiveDirectoryConfigPatch ActiveDirectoryConfigPatch(ManagedServiceIdentity identity = default, IDictionary tags = default, ActiveDirectoryConfigUpdateProperties properties = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new ActiveDirectoryConfigPatch(identity, tags, properties, additionalBinaryDataProperties: null); + } + + /// The updatable properties of the ActiveDirectoryConfig. + /// A domain user account with permission to create machine accounts. + /// An array of DNS server IP addresses(IPv4 only) for the Active Directory. + /// NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. + /// The Organizational Unit (OU) within the Windows Active Directory. + /// The Active Directory site the service will limit Domain Controller discovery to. + /// Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier. + /// Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier. + /// Domain Users in the Active directory to be given SecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. + /// Name of the Active Directory domain. + /// Access password from Azure KeyVault Secrets to connect Active Directory. + /// A new instance for mocking. + public static ActiveDirectoryConfigUpdateProperties ActiveDirectoryConfigUpdateProperties(string userName = default, IEnumerable dns = default, string smbServerName = default, string organizationalUnit = default, string site = default, IEnumerable backupOperators = default, IEnumerable administrators = default, IEnumerable securityOperators = default, string domain = default, SecretPassword secretPassword = default) + { + dns ??= new ChangeTrackingList(); + backupOperators ??= new ChangeTrackingList(); + administrators ??= new ChangeTrackingList(); + securityOperators ??= new ChangeTrackingList(); + + return new ActiveDirectoryConfigUpdateProperties( + userName, + dns.ToList(), + smbServerName, + organizationalUnit, + site, + backupOperators.ToList(), + administrators.ToList(), + securityOperators.ToList(), + domain, + secretPassword, + additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Provides storage to network proximity information in the region. + /// Provides logical availability zone mappings for the subscription for a region. + /// A new instance for mocking. + public static RegionInfoResourceData RegionInfoResourceData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, RegionStorageToNetworkProximity? storageToNetworkProximity = default, IList availabilityZoneMappings = default) + { + return new RegionInfoResourceData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + storageToNetworkProximity is null || availabilityZoneMappings is null ? default : new RegionInfo(storageToNetworkProximity, availabilityZoneMappings, new Dictionary())); + } + + /// Provides region specific information. + /// Provides storage to network proximity information in the region. + /// Provides logical availability zone mappings for the subscription for a region. + /// A new instance for mocking. + public static RegionInfo RegionInfo(RegionStorageToNetworkProximity? storageToNetworkProximity = default, IEnumerable availabilityZoneMappings = default) + { + availabilityZoneMappings ??= new ChangeTrackingList(); + + return new RegionInfo(storageToNetworkProximity, availabilityZoneMappings.ToList(), additionalBinaryDataProperties: null); + } + + /// The AvailabilityZoneMapping. + /// Logical availability zone. + /// Available availability zone. + /// A new instance for mocking. + public static AvailabilityZoneMapping AvailabilityZoneMapping(string availabilityZone = default, bool? isAvailable = default) + { + return new AvailabilityZoneMapping(availabilityZone, isAvailable, additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// Azure lifecycle management. + /// Active Directories. + /// Encryption settings. + /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. + /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. + /// MultiAD Status for the account. + /// LDAP Configuration for the account. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + /// The managed service identities assigned to this resource. + /// A new instance for mocking. + public static NetAppAccountData NetAppAccountData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string provisioningState = default, IList activeDirectories = default, AccountEncryption encryption = default, bool? disableShowmount = default, string nfsV4IDDomain = default, MultiAdStatus? multiAdStatus = default, LdapConfiguration ldapConfiguration = default, string etag = default, ManagedServiceIdentity identity = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new NetAppAccountData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + provisioningState is null || activeDirectories is null || encryption is null || disableShowmount is null || nfsV4IDDomain is null || multiAdStatus is null || ldapConfiguration is null ? default : new AccountProperties( + provisioningState, + activeDirectories, + encryption, + disableShowmount, + nfsV4IDDomain, + multiAdStatus, + ldapConfiguration, + new Dictionary()), + etag, + identity); + } + + /// Active Directory. + /// Id of the Active Directory. + /// A domain user account with permission to create machine accounts. + /// Plain text password of Active Directory domain administrator, value is masked in the response. + /// Name of the Active Directory domain. + /// Comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory domain. + /// Status of the Active Directory. + /// Any details in regards to the Status of the Active Directory. + /// NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. + /// The Organizational Unit (OU) within the Windows Active Directory. + /// The Active Directory site the service will limit Domain Controller discovery to. + /// Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier. + /// Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier. + /// kdc server IP address for the active directory machine. This optional parameter is used only while creating kerberos volume. + /// Name of the active directory machine. This optional parameter is used only while creating kerberos volume. + /// When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded Active Directory Certificate Service's self-signed root CA certificate, this optional parameter is used only for dual protocol with LDAP user-mapping volumes. + /// If enabled, AES encryption will be enabled for SMB communication. + /// Specifies whether or not the LDAP traffic needs to be signed. + /// Domain Users in the Active directory to be given SeSecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. + /// Specifies whether or not the LDAP traffic needs to be secured via TLS. + /// If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes. + /// If enabled, Traffic between the SMB server to Domain Controller (DC) will be encrypted. + /// LDAP Search scope options. + /// Comma separated list of IPv4 addresses of preferred servers for LDAP client. At most two comma separated IPv4 addresses can be passed. + /// A new instance for mocking. + public static ActiveDirectory ActiveDirectory(string activeDirectoryId = default, string username = default, string password = default, string domain = default, string dns = default, ActiveDirectoryStatus? status = default, string statusDetails = default, string smbServerName = default, string organizationalUnit = default, string site = default, IEnumerable backupOperators = default, IEnumerable administrators = default, string kdcIP = default, string adName = default, string serverRootCACertificate = default, bool? aesEncryption = default, bool? ldapSigning = default, IEnumerable securityOperators = default, bool? ldapOverTLS = default, bool? allowLocalNfsUsersWithLdap = default, bool? encryptDCConnections = default, LdapSearchScopeOpt ldapSearchScope = default, string preferredServersForLdapClient = default) + { + backupOperators ??= new ChangeTrackingList(); + administrators ??= new ChangeTrackingList(); + securityOperators ??= new ChangeTrackingList(); + + return new ActiveDirectory( + activeDirectoryId, + username, + password, + domain, + dns, + status, + statusDetails, + smbServerName, + organizationalUnit, + site, + backupOperators.ToList(), + administrators.ToList(), + kdcIP, + adName, + serverRootCACertificate, + aesEncryption, + ldapSigning, + securityOperators.ToList(), + ldapOverTLS, + allowLocalNfsUsersWithLdap, + encryptDCConnections, + ldapSearchScope, + preferredServersForLdapClient, + additionalBinaryDataProperties: null); + } + + /// Properties of key vault. + /// UUID v4 used to identify the Azure Key Vault configuration. + /// The Uri of KeyVault. + /// The name of KeyVault key. + /// The resource ID of KeyVault. + /// Status of the KeyVault connection. + /// A new instance for mocking. + public static KeyVaultProperties KeyVaultProperties(string keyVaultId = default, Uri keyVaultUri = default, string keyName = default, ResourceIdentifier keyVaultResourceId = default, NetAppKeyVaultStatus? status = default) { - return NetAppVolumeBackupStatus(isHealthy: isHealthy, relationshipStatus: relationshipStatus, mirrorState: mirrorState, unhealthyReason: unhealthyReason, errorMessage: errorMessage, lastTransferSize: lastTransferSize, lastTransferType: lastTransferType, totalTransferBytes: totalTransferBytes, transferProgressBytes: default); + return new KeyVaultProperties( + keyVaultId, + keyVaultUri, + keyName, + keyVaultResourceId, + status, + additionalBinaryDataProperties: null); + } + + /// Identity used to authenticate with key vault. + /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. + /// The ARM resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. + /// ClientId of the multi-tenant AAD Application. Used to access cross-tenant keyvaults. + /// A new instance for mocking. + public static EncryptionIdentity EncryptionIdentity(string principalId = default, string userAssignedIdentity = default, string federatedClientId = default) + { + return new EncryptionIdentity(principalId, userAssignedIdentity, federatedClientId, additionalBinaryDataProperties: null); } - /// Initializes a new instance of NetAppVolumeGroupVolume. + /// LDAP configuration. + /// Name of the LDAP configuration domain. + /// List of LDAP server IP addresses (IPv4 only) for the LDAP domain. + /// Specifies whether or not the LDAP traffic needs to be secured via TLS. + /// When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded ldap servers CA certificate. + /// The CN host name used while generating the certificate, LDAP Over TLS requires the CN host name to create DNS host entry. + /// A new instance for mocking. + public static LdapConfiguration LdapConfiguration(string domain = default, IEnumerable ldapServers = default, bool? ldapOverTLS = default, string serverCACertificate = default, string certificateCNHost = default) + { + ldapServers ??= new ChangeTrackingList(); + + return new LdapConfiguration( + domain, + ldapServers.ToList(), + ldapOverTLS, + serverCACertificate, + certificateCNHost, + additionalBinaryDataProperties: null); + } + + /// Resource location. /// Resource Id. /// Resource name. - /// Resource type. + /// Resource type. /// Resource tags. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. + /// Azure lifecycle management. + /// Active Directories. + /// Encryption settings. + /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. + /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. + /// MultiAD Status for the account. + /// LDAP Configuration for the account. + /// The identity used for the resource. + /// A new instance for mocking. + public static NetAppAccountPatch NetAppAccountPatch(string location = default, string id = default, string name = default, string @type = default, IDictionary tags = default, string provisioningState = default, IList activeDirectories = default, AccountEncryption encryption = default, bool? disableShowmount = default, string nfsV4IDDomain = default, MultiAdStatus? multiAdStatus = default, LdapConfiguration ldapConfiguration = default, ManagedServiceIdentity identity = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new NetAppAccountPatch( + location, + id, + name, + @type, + tags, + provisioningState is null || activeDirectories is null || encryption is null || disableShowmount is null || nfsV4IDDomain is null || multiAdStatus is null || ldapConfiguration is null ? default : new AccountProperties( + provisioningState, + activeDirectories, + encryption, + disableShowmount, + nfsV4IDDomain, + multiAdStatus, + ldapConfiguration, + new Dictionary()), + identity, + additionalBinaryDataProperties: null); + } + + /// Encryption transition request. + /// Identifier for the virtual network. + /// Identifier of the private endpoint to reach the Azure Key Vault. + /// A new instance for mocking. + public static EncryptionTransitionRequest EncryptionTransitionRequest(ResourceIdentifier virtualNetworkId = default, ResourceIdentifier privateEndpointId = default) + { + return new EncryptionTransitionRequest(virtualNetworkId, privateEndpointId, additionalBinaryDataProperties: null); + } + + /// The URI of the key vault/managed HSM that should be used for encryption. + /// The name of the key that should be used for encryption. + /// Azure resource ID of the key vault/managed HSM that should be used for encryption. + /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. + /// A new instance for mocking. + public static GetKeyVaultStatusResponse GetKeyVaultStatusResponse(Uri keyVaultUri = default, string keyName = default, ResourceIdentifier keyVaultResourceId = default, IList keyVaultPrivateEndpoints = default) + { + return new GetKeyVaultStatusResponse(keyVaultUri is null || keyName is null || keyVaultResourceId is null || keyVaultPrivateEndpoints is null ? default : new GetKeyVaultStatusResponseProperties(keyVaultUri, keyName, keyVaultResourceId, keyVaultPrivateEndpoints, new Dictionary()), additionalBinaryDataProperties: null); + } + + /// Change key vault request. + /// The URI of the key vault/managed HSM that should be used for encryption. + /// The name of the key that should be used for encryption. + /// Azure resource ID of the key vault/managed HSM that should be used for encryption. + /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. + /// A new instance for mocking. + public static ChangeKeyVault ChangeKeyVault(Uri keyVaultUri = default, string keyName = default, ResourceIdentifier keyVaultResourceId = default, IEnumerable keyVaultPrivateEndpoints = default) + { + keyVaultPrivateEndpoints ??= new ChangeTrackingList(); + + return new ChangeKeyVault(keyVaultUri, keyName, keyVaultResourceId, keyVaultPrivateEndpoints.ToList(), additionalBinaryDataProperties: null); + } + + /// Migrate Backups Request. + /// The ResourceId of the Backup Vault. + /// A new instance for mocking. + public static BackupsMigrationRequest BackupsMigrationRequest(ResourceIdentifier backupVaultId = default) + { + return new BackupsMigrationRequest(backupVaultId, additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// UUID v4 used to identify the Pool. + /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB, 500Tib for LargeVolume. Specified in bytes. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. /// Azure lifecycle management. - /// UUID v4 or resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// UUID v4 or resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// Basic network, or Standard features available to the volume. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - /// DataProtection type volumes include an object containing details of the replication. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeGroupVolume NetAppVolumeGroupVolume(ResourceIdentifier id, string name, ResourceType? resourceType, IDictionary tags, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IEnumerable mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, bool? isCoolAccessEnabled, int? coolnessPeriod, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IEnumerable dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IEnumerable placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId) + /// Total throughput of pool in MiB/s. + /// Utilized throughput of pool in MiB/s. + /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. + /// The qos type of the pool. + /// If enabled (true) the pool can contain cool Access enabled volumes. + /// Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + /// A new instance for mocking. + public static CapacityPoolData CapacityPoolData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string poolId = default, long? size = default, NetAppFileServiceLevel? serviceLevel = default, string provisioningState = default, float? totalThroughputMibps = default, float? utilizedThroughputMibps = default, int? customThroughputMibps = default, QosType? qosType = default, bool? coolAccess = default, CapacityPoolEncryptionType? encryptionType = default, string etag = default) { - return NetAppVolumeGroupVolume(id: id, name: name, resourceType: resourceType, tags: tags, zones: default, fileSystemId: fileSystemId, creationToken: creationToken, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, provisioningState: provisioningState, snapshotId: snapshotId, deleteBaseSnapshot: deleteBaseSnapshot, backupId: backupId, baremetalTenantId: baremetalTenantId, subnetId: subnetId, networkFeatures: networkFeatures, effectiveNetworkFeatures: default, networkSiblingSetId: networkSiblingSetId, storageToNetworkProximity: storageToNetworkProximity, mountTargets: mountTargets, volumeType: volumeType, dataProtection: dataProtection, acceptGrowCapacityPoolForShortTermCloneSplit: default, isRestoring: isRestoring, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, isKerberosEnabled: isKerberosEnabled, securityStyle: securityStyle, isSmbEncryptionEnabled: isSmbEncryptionEnabled, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable, isSmbContinuouslyAvailable: isSmbContinuouslyAvailable, throughputMibps: throughputMibps, actualThroughputMibps: actualThroughputMibps, encryptionKeySource: encryptionKeySource, keyVaultPrivateEndpointResourceId: keyVaultPrivateEndpointResourceId, isLdapEnabled: isLdapEnabled, ldapServerType: default, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: default, coolAccessTieringPolicy: default, unixPermissions: unixPermissions, cloneProgress: cloneProgress, fileAccessLogs: fileAccessLogs, avsDataStore: avsDataStore, dataStoreResourceId: dataStoreResourceId, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, maximumNumberOfFiles: maximumNumberOfFiles, volumeGroupName: volumeGroupName, capacityPoolResourceId: capacityPoolResourceId, proximityPlacementGroupId: proximityPlacementGroupId, t2Network: t2Network, volumeSpecName: volumeSpecName, isEncrypted: isEncrypted, placementRules: placementRules, enableSubvolumes: enableSubvolumes, provisionedAvailabilityZone: provisionedAvailabilityZone, isLargeVolume: isLargeVolume, originatingResourceId: originatingResourceId, inheritedSizeInBytes: default, language: default); + tags ??= new ChangeTrackingDictionary(); + + return new CapacityPoolData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + poolId is null || size is null || serviceLevel is null || provisioningState is null || totalThroughputMibps is null || utilizedThroughputMibps is null || customThroughputMibps is null || qosType is null || coolAccess is null || encryptionType is null ? default : new PoolProperties( + poolId, + size.Value, + serviceLevel.Value, + provisioningState, + totalThroughputMibps, + utilizedThroughputMibps, + customThroughputMibps, + qosType, + coolAccess, + encryptionType, + new Dictionary()), + etag); } - /// Initializes a new instance of . + /// Resource location. /// Resource Id. /// Resource name. - /// Resource type. + /// Resource type. /// Resource tags. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). + /// The qos type of the pool. + /// If enabled (true) the pool can contain cool Access enabled volumes. + /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. + /// A new instance for mocking. + public static CapacityPoolPatch CapacityPoolPatch(string location = default, string id = default, string name = default, string @type = default, IDictionary tags = default, long? size = default, QosType? qosType = default, bool? coolAccess = default, int? customThroughputMibpsInt = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new CapacityPoolPatch( + location, + id, + name, + @type, + tags, + size is null || qosType is null || coolAccess is null || customThroughputMibpsInt is null ? default : new PoolPatchProperties(size, qosType, coolAccess, customThroughputMibpsInt, new Dictionary()), + additionalBinaryDataProperties: null); + } + + /// Restore payload for Single File Backup Restore. + /// List of files to be restored. + /// Destination folder where the files will be restored. The path name should start with a forward slash. If it is omitted from request then restore is done at the root folder of the destination volume by default. + /// Resource Id of the destination volume on which the files need to be restored. + /// A new instance for mocking. + public static BackupRestoreFiles BackupRestoreFiles(IEnumerable fileList = default, string restoreFilePath = default, string destinationVolumeId = default) + { + fileList ??= new ChangeTrackingList(); + + return new BackupRestoreFiles(fileList.ToList(), restoreFilePath, destinationVolumeId, additionalBinaryDataProperties: null); + } + + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Path to the subvolume. + /// Truncate subvolume to the provided size in bytes. + /// parent path to the subvolume. /// Azure lifecycle management. - /// Resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// Resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// Network features available to the volume, or current state of update. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - /// DataProtection type volumes include an object containing details of the replication. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeGroupVolume NetAppVolumeGroupVolume(ResourceIdentifier id, string name, ResourceType? resourceType, IDictionary tags, IEnumerable zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IEnumerable mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IEnumerable dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IEnumerable placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId) + /// A new instance for mocking. + public static SubvolumeInfoData SubvolumeInfoData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, string path = default, long? size = default, string parentPath = default, string provisioningState = default) + { + return new SubvolumeInfoData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + path is null || size is null || parentPath is null || provisioningState is null ? default : new SubvolumeProperties(path, size, parentPath, provisioningState, new Dictionary())); + } + + /// Resource Id. + /// Resource name. + /// Resource type. + /// Path to the subvolume. + /// Path to the parent subvolume. + /// Size of subvolume. + /// Bytes used. + /// Permissions of the subvolume. + /// Creation time and date. + /// Most recent access time and date. + /// Most recent modification time and date. + /// Most recent change time and date. + /// Azure lifecycle management. + /// A new instance for mocking. + public static SubvolumeModel SubvolumeModel(string id = default, string name = default, string @type = default, string path = default, string parentPath = default, long? size = default, long? bytesUsed = default, string permissions = default, DateTimeOffset? creationTimeStamp = default, DateTimeOffset? accessedTimeStamp = default, DateTimeOffset? modifiedTimeStamp = default, DateTimeOffset? changedTimeStamp = default, string provisioningState = default) + { + return new SubvolumeModel(id, name, @type, path is null || parentPath is null || size is null || bytesUsed is null || permissions is null || creationTimeStamp is null || accessedTimeStamp is null || modifiedTimeStamp is null || changedTimeStamp is null || provisioningState is null ? default : new SubvolumeModelProperties( + path, + parentPath, + size, + bytesUsed, + permissions, + creationTimeStamp, + accessedTimeStamp, + modifiedTimeStamp, + changedTimeStamp, + provisioningState, + new Dictionary()), additionalBinaryDataProperties: null); + } + + /// Resource name availability request content. + /// Resource name to verify. + /// Resource type used for verification. + /// Resource group name. + /// A new instance for mocking. + public static ResourceNameAvailabilityRequest ResourceNameAvailabilityRequest(string name = default, CheckNameResourceTypes @type = default, string resourceGroup = default) { - return NetAppVolumeGroupVolume(id: id, name: name, resourceType: resourceType, tags: tags, zones: zones, fileSystemId: fileSystemId, creationToken: creationToken, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, provisioningState: provisioningState, snapshotId: snapshotId, deleteBaseSnapshot: deleteBaseSnapshot, backupId: backupId, baremetalTenantId: baremetalTenantId, subnetId: subnetId, networkFeatures: networkFeatures, effectiveNetworkFeatures: default, networkSiblingSetId: networkSiblingSetId, storageToNetworkProximity: storageToNetworkProximity, mountTargets: mountTargets, volumeType: volumeType, dataProtection: dataProtection, acceptGrowCapacityPoolForShortTermCloneSplit: default, isRestoring: isRestoring, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, isKerberosEnabled: isKerberosEnabled, securityStyle: securityStyle, isSmbEncryptionEnabled: isSmbEncryptionEnabled, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable, isSmbContinuouslyAvailable: isSmbContinuouslyAvailable, throughputMibps: throughputMibps, actualThroughputMibps: actualThroughputMibps, encryptionKeySource: encryptionKeySource, keyVaultPrivateEndpointResourceId: keyVaultPrivateEndpointResourceId, isLdapEnabled: isLdapEnabled, ldapServerType: default, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: coolAccessRetrievalPolicy, coolAccessTieringPolicy: default, unixPermissions: unixPermissions, cloneProgress: cloneProgress, fileAccessLogs: fileAccessLogs, avsDataStore: avsDataStore, dataStoreResourceId: dataStoreResourceId, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, maximumNumberOfFiles: maximumNumberOfFiles, volumeGroupName: volumeGroupName, capacityPoolResourceId: capacityPoolResourceId, proximityPlacementGroupId: proximityPlacementGroupId, t2Network: t2Network, volumeSpecName: volumeSpecName, isEncrypted: isEncrypted, placementRules: placementRules, enableSubvolumes: enableSubvolumes, provisionedAvailabilityZone: provisionedAvailabilityZone, isLargeVolume: isLargeVolume, originatingResourceId: originatingResourceId, inheritedSizeInBytes: default, language: default); + return new ResourceNameAvailabilityRequest(name, @type, resourceGroup, additionalBinaryDataProperties: null); } - /// Initializes a new instance of NetAppVolumeData. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB, 500Tib for LargeVolume. Specified in bytes. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - /// Azure lifecycle management. - /// UUID v4 or resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// UUID v4 or resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// Basic network, or Standard features available to the volume. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - /// DataProtection type volumes include an object containing details of the replication. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeData NetAppVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, IEnumerable zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IEnumerable mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, bool? isCoolAccessEnabled, int? coolnessPeriod, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IEnumerable dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IEnumerable placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId) + /// Information regarding availability of a resource. + /// <code>true</code> indicates name is valid and available. <code>false</code> indicates the name is invalid, unavailable, or both. + /// <code>Invalid</code> indicates the name provided does not match Azure App Service naming requirements. <code>AlreadyExists</code> indicates that the name is already in use and is therefore unavailable. + /// If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. + /// A new instance for mocking. + public static CheckAvailabilityResponse CheckAvailabilityResponse(bool? isAvailable = default, InAvailabilityReasonType? reason = default, string message = default) { - return NetAppVolumeData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, etag: etag, zones: zones, fileSystemId: fileSystemId, creationToken: creationToken, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, provisioningState: provisioningState, snapshotId: snapshotId, deleteBaseSnapshot: deleteBaseSnapshot, backupId: backupId, baremetalTenantId: baremetalTenantId, subnetId: subnetId, networkFeatures: networkFeatures, effectiveNetworkFeatures: default, networkSiblingSetId: networkSiblingSetId, storageToNetworkProximity: storageToNetworkProximity, mountTargets: mountTargets, volumeType: volumeType, dataProtection: dataProtection, acceptGrowCapacityPoolForShortTermCloneSplit: default, isRestoring: isRestoring, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, isKerberosEnabled: isKerberosEnabled, securityStyle: securityStyle, isSmbEncryptionEnabled: isSmbEncryptionEnabled, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable, isSmbContinuouslyAvailable: isSmbContinuouslyAvailable, throughputMibps: throughputMibps, actualThroughputMibps: actualThroughputMibps, encryptionKeySource: encryptionKeySource, keyVaultPrivateEndpointResourceId: keyVaultPrivateEndpointResourceId, isLdapEnabled: isLdapEnabled, ldapServerType: default, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: default, coolAccessTieringPolicy: default, unixPermissions: unixPermissions, cloneProgress: cloneProgress, fileAccessLogs: fileAccessLogs, avsDataStore: avsDataStore, dataStoreResourceId: dataStoreResourceId, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, maximumNumberOfFiles: maximumNumberOfFiles, volumeGroupName: volumeGroupName, capacityPoolResourceId: capacityPoolResourceId, proximityPlacementGroupId: proximityPlacementGroupId, t2Network: t2Network, volumeSpecName: volumeSpecName, isEncrypted: isEncrypted, placementRules: placementRules, enableSubvolumes: enableSubvolumes, provisionedAvailabilityZone: provisionedAvailabilityZone, isLargeVolume: isLargeVolume, originatingResourceId: originatingResourceId, inheritedSizeInBytes: default, language: default); + return new CheckAvailabilityResponse(isAvailable, reason, message, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - /// Azure lifecycle management. - /// Resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// Resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. + /// File path availability request content - availability is based on the name and the subnetId. + /// File path to verify. /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// Network features available to the volume, or current state of update. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - /// DataProtection type volumes include an object containing details of the replication. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeData NetAppVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, IEnumerable zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IEnumerable mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IEnumerable dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IEnumerable placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId) + /// The Azure Resource logical availability zone which is used within zone mapping lookup for the subscription and region. The lookup will retrieve the physical zone where volume is placed. + /// A new instance for mocking. + public static FilePathAvailabilityRequest FilePathAvailabilityRequest(string name = default, string subnetId = default, string availabilityZone = default) { - return NetAppVolumeData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, etag: etag, zones: zones, fileSystemId: fileSystemId, creationToken: creationToken, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, provisioningState: provisioningState, snapshotId: snapshotId, deleteBaseSnapshot: deleteBaseSnapshot, backupId: backupId, baremetalTenantId: baremetalTenantId, subnetId: subnetId, networkFeatures: networkFeatures, effectiveNetworkFeatures: default, networkSiblingSetId: networkSiblingSetId, storageToNetworkProximity: storageToNetworkProximity, mountTargets: mountTargets, volumeType: volumeType, dataProtection: dataProtection, acceptGrowCapacityPoolForShortTermCloneSplit: default, isRestoring: isRestoring, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, isKerberosEnabled: isKerberosEnabled, securityStyle: securityStyle, isSmbEncryptionEnabled: isSmbEncryptionEnabled, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable, isSmbContinuouslyAvailable: isSmbContinuouslyAvailable, throughputMibps: throughputMibps, actualThroughputMibps: actualThroughputMibps, encryptionKeySource: encryptionKeySource, keyVaultPrivateEndpointResourceId: keyVaultPrivateEndpointResourceId, isLdapEnabled: isLdapEnabled, ldapServerType: default, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: coolAccessRetrievalPolicy, coolAccessTieringPolicy: default, unixPermissions: unixPermissions, cloneProgress: cloneProgress, fileAccessLogs: fileAccessLogs, avsDataStore: avsDataStore, dataStoreResourceId: dataStoreResourceId, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, maximumNumberOfFiles: maximumNumberOfFiles, volumeGroupName: volumeGroupName, capacityPoolResourceId: capacityPoolResourceId, proximityPlacementGroupId: proximityPlacementGroupId, t2Network: t2Network, volumeSpecName: volumeSpecName, isEncrypted: isEncrypted, placementRules: placementRules, enableSubvolumes: enableSubvolumes, provisionedAvailabilityZone: provisionedAvailabilityZone, isLargeVolume: isLargeVolume, originatingResourceId: originatingResourceId, inheritedSizeInBytes: default, language: default); + return new FilePathAvailabilityRequest(name, subnetId, availabilityZone, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - /// Azure lifecycle management. - /// Resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// Resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// The original value of the network features type available to the volume at the time it was created. - /// The effective value of the network features type available to the volume, or current effective state of update. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - /// DataProtection type volumes include an object containing details of the replication. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeData NetAppVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, IEnumerable zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, NetAppNetworkFeature? effectiveNetworkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IEnumerable mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IEnumerable dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IEnumerable placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId) + /// Quota availability request content. + /// Name of the resource to verify. + /// Resource type used for verification. + /// Resource group name. + /// A new instance for mocking. + public static QuotaAvailabilityRequest QuotaAvailabilityRequest(string name = default, CheckQuotaNameResourceTypes @type = default, string resourceGroup = default) { - return NetAppVolumeData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, etag: etag, zones: zones, fileSystemId: fileSystemId, creationToken: creationToken, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, provisioningState: provisioningState, snapshotId: snapshotId, deleteBaseSnapshot: deleteBaseSnapshot, backupId: backupId, baremetalTenantId: baremetalTenantId, subnetId: subnetId, networkFeatures: networkFeatures, effectiveNetworkFeatures: effectiveNetworkFeatures, networkSiblingSetId: networkSiblingSetId, storageToNetworkProximity: storageToNetworkProximity, mountTargets: mountTargets, volumeType: volumeType, dataProtection: dataProtection, acceptGrowCapacityPoolForShortTermCloneSplit: default, isRestoring: isRestoring, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, isKerberosEnabled: isKerberosEnabled, securityStyle: securityStyle, isSmbEncryptionEnabled: isSmbEncryptionEnabled, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable, isSmbContinuouslyAvailable: isSmbContinuouslyAvailable, throughputMibps: throughputMibps, actualThroughputMibps: actualThroughputMibps, encryptionKeySource: encryptionKeySource, keyVaultPrivateEndpointResourceId: keyVaultPrivateEndpointResourceId, isLdapEnabled: isLdapEnabled, ldapServerType: default, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: coolAccessRetrievalPolicy, coolAccessTieringPolicy: default, unixPermissions: unixPermissions, cloneProgress: cloneProgress, fileAccessLogs: fileAccessLogs, avsDataStore: avsDataStore, dataStoreResourceId: dataStoreResourceId, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, maximumNumberOfFiles: maximumNumberOfFiles, volumeGroupName: volumeGroupName, capacityPoolResourceId: capacityPoolResourceId, proximityPlacementGroupId: proximityPlacementGroupId, t2Network: t2Network, volumeSpecName: volumeSpecName, isEncrypted: isEncrypted, placementRules: placementRules, enableSubvolumes: enableSubvolumes, provisionedAvailabilityZone: provisionedAvailabilityZone, isLargeVolume: isLargeVolume, originatingResourceId: originatingResourceId, inheritedSizeInBytes: default, language: default); + return new QuotaAvailabilityRequest(name, @type, resourceGroup, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// DataProtection type volumes include an object containing details of the replication. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumePatch NetAppVolumePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetAppFileServiceLevel? serviceLevel, long? usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, float? throughputMibps, NetAppVolumePatchDataProtection dataProtection, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, string unixPermissions, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, bool? isSnapshotDirectoryVisible, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable) + /// Network sibling set query. + /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. + /// A new instance for mocking. + public static QueryNetworkSiblingSetRequest QueryNetworkSiblingSetRequest(string networkSiblingSetId = default, ResourceIdentifier subnetId = default) { - return NetAppVolumePatch(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, throughputMibps: throughputMibps, dataProtection: dataProtection, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, unixPermissions: unixPermissions, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: coolAccessRetrievalPolicy, coolAccessTieringPolicy: default, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable); + return new QueryNetworkSiblingSetRequest(networkSiblingSetId, subnetId, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Resource Id. - /// Resource name. - /// Resource type. - /// Resource tags. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - /// Azure lifecycle management. - /// Resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// Resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// The original value of the network features type available to the volume at the time it was created. - /// The effective value of the network features type available to the volume, or current effective state of update. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - /// DataProtection type volumes include an object containing details of the replication. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeGroupVolume NetAppVolumeGroupVolume(ResourceIdentifier id, string name, ResourceType? resourceType, IDictionary tags, IEnumerable zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, IEnumerable exportRules, IEnumerable protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, NetAppNetworkFeature? effectiveNetworkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IEnumerable mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IEnumerable dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IEnumerable placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId) + /// Describes the contents of a network sibling set. + /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. + /// Network sibling set state Id identifying the current state of the sibling set. + /// Network features available to the volume, or current state of update. + /// Gets the status of the NetworkSiblingSet at the time the operation was called. + /// List of NIC information. + /// A new instance for mocking. + public static NetworkSiblingSet NetworkSiblingSet(string networkSiblingSetId = default, ResourceIdentifier subnetId = default, string networkSiblingSetStateId = default, NetworkFeatures? networkFeatures = default, NetworkSiblingSetProvisioningState? provisioningState = default, IEnumerable nicInfoList = default) + { + nicInfoList ??= new ChangeTrackingList(); + + return new NetworkSiblingSet( + networkSiblingSetId, + subnetId, + networkSiblingSetStateId, + networkFeatures, + provisioningState, + nicInfoList.ToList(), + additionalBinaryDataProperties: null); + } + + /// NIC information and list of volumes for which the NIC has the primary mount ip address. + /// ipAddress. + /// Volume resource Ids. + /// A new instance for mocking. + public static NicInfo NicInfo(string ipAddress = default, IEnumerable volumeResourceIds = default) { - return NetAppVolumeGroupVolume(id: id, name: name, resourceType: resourceType, tags: tags, zones: zones, fileSystemId: fileSystemId, creationToken: creationToken, serviceLevel: serviceLevel, usageThreshold: usageThreshold, exportRules: exportRules, protocolTypes: protocolTypes, provisioningState: provisioningState, snapshotId: snapshotId, deleteBaseSnapshot: deleteBaseSnapshot, backupId: backupId, baremetalTenantId: baremetalTenantId, subnetId: subnetId, networkFeatures: networkFeatures, effectiveNetworkFeatures: effectiveNetworkFeatures, networkSiblingSetId: networkSiblingSetId, storageToNetworkProximity: storageToNetworkProximity, mountTargets: mountTargets, volumeType: volumeType, dataProtection: dataProtection, acceptGrowCapacityPoolForShortTermCloneSplit: default, isRestoring: isRestoring, isSnapshotDirectoryVisible: isSnapshotDirectoryVisible, isKerberosEnabled: isKerberosEnabled, securityStyle: securityStyle, isSmbEncryptionEnabled: isSmbEncryptionEnabled, smbAccessBasedEnumeration: smbAccessBasedEnumeration, smbNonBrowsable: smbNonBrowsable, isSmbContinuouslyAvailable: isSmbContinuouslyAvailable, throughputMibps: throughputMibps, actualThroughputMibps: actualThroughputMibps, encryptionKeySource: encryptionKeySource, keyVaultPrivateEndpointResourceId: keyVaultPrivateEndpointResourceId, isLdapEnabled: isLdapEnabled, ldapServerType: default, isCoolAccessEnabled: isCoolAccessEnabled, coolnessPeriod: coolnessPeriod, coolAccessRetrievalPolicy: coolAccessRetrievalPolicy, coolAccessTieringPolicy: default, unixPermissions: unixPermissions, cloneProgress: cloneProgress, fileAccessLogs: fileAccessLogs, avsDataStore: avsDataStore, dataStoreResourceId: dataStoreResourceId, isDefaultQuotaEnabled: isDefaultQuotaEnabled, defaultUserQuotaInKiBs: defaultUserQuotaInKiBs, defaultGroupQuotaInKiBs: defaultGroupQuotaInKiBs, maximumNumberOfFiles: maximumNumberOfFiles, volumeGroupName: volumeGroupName, capacityPoolResourceId: capacityPoolResourceId, proximityPlacementGroupId: proximityPlacementGroupId, t2Network: t2Network, volumeSpecName: volumeSpecName, isEncrypted: isEncrypted, placementRules: placementRules, enableSubvolumes: enableSubvolumes, provisionedAvailabilityZone: provisionedAvailabilityZone, isLargeVolume: isLargeVolume, originatingResourceId: originatingResourceId, inheritedSizeInBytes: default, language: default); + volumeResourceIds ??= new ChangeTrackingList(); + + return new NicInfo(ipAddress, volumeResourceIds.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Id. - /// Indicates whether the local volume is the source or destination for the Volume Replication. - /// Schedule. - /// The resource ID of the remote volume. - /// The remote region for the other end of the Volume Replication. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppReplicationObject NetAppReplicationObject(string replicationId, NetAppEndpointType? endpointType, NetAppReplicationSchedule? replicationSchedule, ResourceIdentifier remoteVolumeResourceId, string remoteVolumeRegion) + /// Network sibling set update. + /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. + /// Network sibling set state Id identifying the current state of the sibling set. + /// Network features available to the volume. + /// A new instance for mocking. + public static UpdateNetworkSiblingSetRequest UpdateNetworkSiblingSetRequest(string networkSiblingSetId = default, ResourceIdentifier subnetId = default, string networkSiblingSetStateId = default, NetworkFeatures networkFeatures = default) { - return NetAppReplicationObject(replicationId: replicationId, endpointType: endpointType, replicationSchedule: replicationSchedule, remoteVolumeResourceId: remoteVolumeResourceId, remotePath: default, remoteVolumeRegion: remoteVolumeRegion, destinationReplications: default, externalReplicationSetupStatus: default, externalReplicationSetupInfo: default, mirrorState: default, relationshipStatus: default); + return new UpdateNetworkSiblingSetRequest(networkSiblingSetId, subnetId, networkSiblingSetStateId, networkFeatures, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Indicates whether the local volume is the source or destination for the Volume Replication. - /// Schedule. - /// The resource ID of the remote volume. - /// The remote region for the other end of the Volume Replication. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeReplication NetAppVolumeReplication(NetAppEndpointType? endpointType, NetAppReplicationSchedule? replicationSchedule, ResourceIdentifier remoteVolumeResourceId, string remoteVolumeRegion) + /// The id of the usage. + /// The name of the usage. + /// The current usage value for the subscription. + /// The limit of the usage. + /// The unit of the usage. + /// A new instance for mocking. + public static UsageResult UsageResult(string id = default, UsageName name = default, int? currentValue = default, int? limit = default, string unit = default) { - return NetAppVolumeReplication(replicationId: default, endpointType: endpointType, replicationSchedule: replicationSchedule, remoteVolumeResourceId: remoteVolumeResourceId, remoteVolumeRegion: remoteVolumeRegion); + return new UsageResult(id, name, currentValue is null || limit is null || unit is null ? default : new UsageProperties(currentValue, limit, unit, new Dictionary()), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// Volume name. - /// Total count of backups for volume. - /// Policy enabled. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static NetAppVolumeBackupDetail NetAppVolumeBackupDetail(string volumeName, int? backupsCount, bool? isPolicyEnabled) + /// The name of the usage. + /// The name of the usage. + /// The localized name of the usage. + /// A new instance for mocking. + public static UsageName UsageName(string value = default, string localizedValue = default) { - return NetAppVolumeBackupDetail(volumeName: volumeName, volumeResourceId: default, backupsCount: backupsCount, isPolicyEnabled: isPolicyEnabled); + return new UsageName(value, localizedValue, additionalBinaryDataProperties: null); } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupCollection.cs new file mode 100644 index 000000000000..ac512d33898d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupCollection.cs @@ -0,0 +1,567 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetBackups method from an instance of the parent resource. + /// + public partial class BackupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _backupsClientDiagnostics; + private readonly Backups _backupsRestClient; + private readonly ClientDiagnostics _backupsUnderBackupVaultClientDiagnostics; + private readonly BackupsUnderBackupVault _backupsUnderBackupVaultRestClient; + + /// Initializes a new instance of BackupCollection for mocking. + protected BackupCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BackupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(BackupResource.ResourceType, out string backupApiVersion); + _backupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", BackupResource.ResourceType.Namespace, Diagnostics); + _backupsRestClient = new Backups(_backupsClientDiagnostics, Pipeline, Endpoint, backupApiVersion ?? "2025-09-01-preview"); + _backupsUnderBackupVaultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", BackupResource.ResourceType.Namespace, Diagnostics); + _backupsUnderBackupVaultRestClient = new BackupsUnderBackupVault(_backupsUnderBackupVaultClientDiagnostics, Pipeline, Endpoint, backupApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != BackupVaultResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, BackupVaultResource.ResourceType), id); + } + } + + /// + /// Create a backup under the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the backup. + /// Backup object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string backupName, BackupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, BackupData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupOperationSource(Client), + _backupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a backup under the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the backup. + /// Backup object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string backupName, BackupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, BackupData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupOperationSource(Client), + _backupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Backup under Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Backup under Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all backups Under a Backup Vault. + /// An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = default, CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new BackupsGetByVaultAsyncCollectionResultOfT( + _backupsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + filter, + context), data => new BackupResource(Client, data)); + } + + /// List all backups Under a Backup Vault. + /// An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = default, CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new BackupsGetByVaultCollectionResultOfT( + _backupsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + filter, + context), data => new BackupResource(Client, data)); + } + + /// + /// Get the specified Backup under Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Backup under Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Backup under Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new BackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Backup under Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the backup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new BackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupData.Serialization.cs new file mode 100644 index 000000000000..1566ceda0fae --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupData.Serialization.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Backup under a Backup Vault. + public partial class BackupData : ResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal BackupData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (BackupData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupData DeserializeBackupData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + BackupProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = BackupProperties.DeserializeBackupProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (BackupData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BackupData backupData) + { + if (backupData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(backupData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static BackupData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeBackupData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupData.cs new file mode 100644 index 000000000000..40ca9acfabde --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupData.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Backup under a Backup Vault. + public partial class BackupData : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// ResourceId used to identify the Volume. + /// is null. + public BackupData(ResourceIdentifier volumeResourceId) + { + Argument.AssertNotNull(volumeResourceId, nameof(volumeResourceId)); + + VolumeResourceId = volumeResourceId; + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Backup Properties. + internal BackupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, BackupProperties properties) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// Backup Properties. + internal BackupProperties Properties { get; set; } + + /// UUID v4 used to identify the Backup. + public string BackupId + { + get + { + return Properties is null ? default : Properties.BackupId; + } + } + + /// The creation date of the backup. + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + + /// The snapshot creation date of the backup. + public DateTimeOffset? SnapshotCreationOn + { + get + { + return Properties is null ? default : Properties.SnapshotCreationOn; + } + } + + /// The completion date of the backup. + public DateTimeOffset? CompletionOn + { + get + { + return Properties is null ? default : Properties.CompletionOn; + } + } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Size of backup in bytes. + public long? Size + { + get + { + return Properties is null ? default : Properties.Size; + } + } + + /// Label for backup. + public string Label + { + get + { + return Properties is null ? default : Properties.Label; + } + set + { + if (Properties is null) + { + Properties = new BackupProperties(); + } + Properties.Label = value; + } + } + + /// Type of backup Manual or Scheduled. + public NetAppBackupType? BackupType + { + get + { + return Properties is null ? default : Properties.BackupType; + } + } + + /// Failure reason. + public string FailureReason + { + get + { + return Properties is null ? default : Properties.FailureReason; + } + } + + /// ResourceId used to identify the Volume. + public ResourceIdentifier VolumeResourceId + { + get + { + return Properties is null ? default : Properties.VolumeResourceId; + } + set + { + if (Properties is null) + { + Properties = new BackupProperties(); + } + Properties.VolumeResourceId = value; + } + } + + /// Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups. + public bool? UseExistingSnapshot + { + get + { + return Properties is null ? default : Properties.UseExistingSnapshot; + } + set + { + if (Properties is null) + { + Properties = new BackupProperties(); + } + Properties.UseExistingSnapshot = value.Value; + } + } + + /// The name of the snapshot. + public string SnapshotName + { + get + { + return Properties is null ? default : Properties.SnapshotName; + } + set + { + if (Properties is null) + { + Properties = new BackupProperties(); + } + Properties.SnapshotName = value; + } + } + + /// ResourceId used to identify the backup policy. + public ResourceIdentifier BackupPolicyResourceId + { + get + { + return Properties is null ? default : Properties.BackupPolicyResourceId; + } + } + + /// Specifies if the backup is for a large volume. + public bool? IsLargeVolume + { + get + { + return Properties is null ? default : Properties.IsLargeVolume; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPoliciesGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPoliciesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..f2ac5d75a15a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPoliciesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class BackupPoliciesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly BackupPolicies _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of BackupPoliciesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The BackupPolicies client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public BackupPoliciesGetAllAsyncCollectionResultOfT(BackupPolicies client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of BackupPoliciesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of BackupPoliciesGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + BackupPoliciesList result = BackupPoliciesList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("BackupPolicyCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPoliciesGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPoliciesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..dcc4e9b3ca36 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPoliciesGetAllCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class BackupPoliciesGetAllCollectionResultOfT : Pageable + { + private readonly BackupPolicies _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of BackupPoliciesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The BackupPolicies client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public BackupPoliciesGetAllCollectionResultOfT(BackupPolicies client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of BackupPoliciesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of BackupPoliciesGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + BackupPoliciesList result = BackupPoliciesList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("BackupPolicyCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyCollection.cs new file mode 100644 index 000000000000..c02cd93d4a16 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyCollection.cs @@ -0,0 +1,547 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetBackupPolicies method from an instance of the parent resource. + /// + public partial class BackupPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _backupPoliciesClientDiagnostics; + private readonly BackupPolicies _backupPoliciesRestClient; + + /// Initializes a new instance of BackupPolicyCollection for mocking. + protected BackupPolicyCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BackupPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(BackupPolicyResource.ResourceType, out string backupPolicyApiVersion); + _backupPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", BackupPolicyResource.ResourceType.Namespace, Diagnostics); + _backupPoliciesRestClient = new BackupPolicies(_backupPoliciesClientDiagnostics, Pipeline, Endpoint, backupPolicyApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NetAppAccountResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, NetAppAccountResource.ResourceType), id); + } + } + + /// + /// Create a backup policy for Netapp Account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Backup policy Name which uniquely identify backup policy. + /// Backup policy object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string backupPolicyName, BackupPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, BackupPolicyData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupPolicyOperationSource(Client), + _backupPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a backup policy for Netapp Account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Backup policy Name which uniquely identify backup policy. + /// Backup policy object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string backupPolicyName, BackupPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, BackupPolicyData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupPolicyOperationSource(Client), + _backupPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a particular backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// Backup policy Name which uniquely identify backup policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a particular backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// Backup policy Name which uniquely identify backup policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List backup policies for Netapp Account. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new BackupPoliciesGetAllAsyncCollectionResultOfT(_backupPoliciesRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new BackupPolicyResource(Client, data)); + } + + /// List backup policies for Netapp Account. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new BackupPoliciesGetAllCollectionResultOfT(_backupPoliciesRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new BackupPolicyResource(Client, data)); + } + + /// + /// Get a particular backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// Backup policy Name which uniquely identify backup policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a particular backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// Backup policy Name which uniquely identify backup policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a particular backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// Backup policy Name which uniquely identify backup policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a particular backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// Backup policy Name which uniquely identify backup policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyData.Serialization.cs new file mode 100644 index 000000000000..cd55fe136313 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyData.Serialization.cs @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Backup policy information. + public partial class BackupPolicyData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal BackupPolicyData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupPolicyData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (BackupPolicyData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupPolicyData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupPolicyData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupPolicyData DeserializeBackupPolicyData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + BackupPolicyProperties properties = default; + string eTag = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = BackupPolicyProperties.DeserializeBackupPolicyProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("etag"u8)) + { + eTag = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupPolicyData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + eTag); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupPolicyData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (BackupPolicyData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupPolicyData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupPolicyData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BackupPolicyData backupPolicyData) + { + if (backupPolicyData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(backupPolicyData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static BackupPolicyData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeBackupPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyData.cs new file mode 100644 index 000000000000..29693bca40fb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyData.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Backup policy information. + public partial class BackupPolicyData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public BackupPolicyData(AzureLocation location) : base(location) + { + + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// Backup policy Properties. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + internal BackupPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, BackupPolicyProperties properties, string eTag) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; + } + + /// Backup policy Properties. + internal BackupPolicyProperties Properties { get; set; } + + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + public string ETag { get; } + + /// Backup Policy GUID ID. + public string BackupPolicyId + { + get + { + return Properties is null ? default : Properties.BackupPolicyId; + } + } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Daily backups count to keep. + public int? DailyBackupsToKeep + { + get + { + return Properties is null ? default : Properties.DailyBackupsToKeep; + } + set + { + if (Properties is null) + { + Properties = new BackupPolicyProperties(); + } + Properties.DailyBackupsToKeep = value.Value; + } + } + + /// Weekly backups count to keep. + public int? WeeklyBackupsToKeep + { + get + { + return Properties is null ? default : Properties.WeeklyBackupsToKeep; + } + set + { + if (Properties is null) + { + Properties = new BackupPolicyProperties(); + } + Properties.WeeklyBackupsToKeep = value.Value; + } + } + + /// Monthly backups count to keep. + public int? MonthlyBackupsToKeep + { + get + { + return Properties is null ? default : Properties.MonthlyBackupsToKeep; + } + set + { + if (Properties is null) + { + Properties = new BackupPolicyProperties(); + } + Properties.MonthlyBackupsToKeep = value.Value; + } + } + + /// Volumes using current backup policy. + public int? VolumesAssigned + { + get + { + return Properties is null ? default : Properties.VolumesAssigned; + } + } + + /// The property to decide policy is enabled or not. + public bool? Enabled + { + get + { + return Properties is null ? default : Properties.Enabled; + } + set + { + if (Properties is null) + { + Properties = new BackupPolicyProperties(); + } + Properties.Enabled = value.Value; + } + } + + /// A list of volumes assigned to this policy. + public IReadOnlyList VolumeBackups + { + get + { + if (Properties is null) + { + Properties = new BackupPolicyProperties(); + } + return Properties.VolumeBackups; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyResource.Serialization.cs new file mode 100644 index 000000000000..58b9bec0d38d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class BackupPolicyResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new BackupPolicyData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + BackupPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + BackupPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyResource.cs new file mode 100644 index 000000000000..8ac85bd66197 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupPolicyResource.cs @@ -0,0 +1,683 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a BackupPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetBackupPolicies method. + /// + public partial class BackupPolicyResource : ArmResource + { + private readonly ClientDiagnostics _backupPoliciesClientDiagnostics; + private readonly BackupPolicies _backupPoliciesRestClient; + private readonly BackupPolicyData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/backupPolicies"; + + /// Initializes a new instance of BackupPolicyResource for mocking. + protected BackupPolicyResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BackupPolicyResource(ArmClient client, BackupPolicyData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BackupPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string backupPolicyApiVersion); + _backupPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _backupPoliciesRestClient = new BackupPolicies(_backupPoliciesClientDiagnostics, Pipeline, Endpoint, backupPolicyApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual BackupPolicyData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The backupPolicyName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get a particular backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a particular backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch a backup policy for Netapp Account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Backup policy object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, BackupPolicyPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, BackupPolicyPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupPolicyOperationSource(Client), + _backupPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch a backup policy for Netapp Account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Backup policy object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, BackupPolicyPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, BackupPolicyPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupPolicyOperationSource(Client), + _backupPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete backup policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_backupPoliciesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete backup policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// BackupPolicies_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_backupPoliciesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + BackupPolicyPatch patch = new BackupPolicyPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + BackupPolicyPatch patch = new BackupPolicyPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + BackupPolicyPatch patch = new BackupPolicyPatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + BackupPolicyPatch patch = new BackupPolicyPatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + BackupPolicyPatch patch = new BackupPolicyPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _backupPoliciesClientDiagnostics.CreateScope("BackupPolicyResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupPolicyData.FromResponse(result), result); + return Response.FromValue(new BackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + BackupPolicyPatch patch = new BackupPolicyPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupResource.Serialization.cs new file mode 100644 index 000000000000..315b62fe3eda --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class BackupResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new BackupData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + BackupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + BackupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupResource.cs new file mode 100644 index 000000000000..ea9ac8ad65ca --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupResource.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a Backup along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetBackups method. + /// + public partial class BackupResource : ArmResource + { + private readonly ClientDiagnostics _backupsClientDiagnostics; + private readonly Backups _backupsRestClient; + private readonly ClientDiagnostics _backupsUnderBackupVaultClientDiagnostics; + private readonly BackupsUnderBackupVault _backupsUnderBackupVaultRestClient; + private readonly BackupData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/backupVaults/backups"; + + /// Initializes a new instance of BackupResource for mocking. + protected BackupResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BackupResource(ArmClient client, BackupData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BackupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string backupApiVersion); + _backupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _backupsRestClient = new Backups(_backupsClientDiagnostics, Pipeline, Endpoint, backupApiVersion ?? "2025-09-01-preview"); + _backupsUnderBackupVaultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _backupsUnderBackupVaultRestClient = new BackupsUnderBackupVault(_backupsUnderBackupVaultClientDiagnostics, Pipeline, Endpoint, backupApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual BackupData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The backupVaultName. + /// The backupName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the specified Backup under Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Backup under Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch a Backup under the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Backup object supplied in the body of the operation. + /// The cancellation token to use. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, BackupPatch body = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BackupPatch.ToRequestContent(body), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupOperationSource(Client), + _backupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch a Backup under the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Backup object supplied in the body of the operation. + /// The cancellation token to use. + public virtual ArmOperation Update(WaitUntil waitUntil, BackupPatch body = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BackupPatch.ToRequestContent(body), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupOperationSource(Client), + _backupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Backup under the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_backupsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Backup under the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// Backups_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("BackupResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_backupsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Restore the specified files from the specified backup to the active filesystem + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}/restoreFiles. + /// + /// + /// Operation Id. + /// Backups_RestoreFiles. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Restore payload supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task RestoreFilesAsync(WaitUntil waitUntil, BackupRestoreFiles body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using DiagnosticScope scope = _backupsUnderBackupVaultClientDiagnostics.CreateScope("BackupResource.RestoreFiles"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsUnderBackupVaultRestClient.CreateRestoreFilesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BackupRestoreFiles.ToRequestContent(body), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_backupsUnderBackupVaultClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Restore the specified files from the specified backup to the active filesystem + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}/restoreFiles. + /// + /// + /// Operation Id. + /// Backups_RestoreFiles. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Restore payload supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation RestoreFiles(WaitUntil waitUntil, BackupRestoreFiles body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using DiagnosticScope scope = _backupsUnderBackupVaultClientDiagnostics.CreateScope("BackupResource.RestoreFiles"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsUnderBackupVaultRestClient.CreateRestoreFilesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BackupRestoreFiles.ToRequestContent(body), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_backupsUnderBackupVaultClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultCollection.cs new file mode 100644 index 000000000000..5b57617ccc2c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultCollection.cs @@ -0,0 +1,547 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetBackupVaults method from an instance of the parent resource. + /// + public partial class BackupVaultCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _backupVaultsClientDiagnostics; + private readonly BackupVaults _backupVaultsRestClient; + + /// Initializes a new instance of BackupVaultCollection for mocking. + protected BackupVaultCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BackupVaultCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(BackupVaultResource.ResourceType, out string backupVaultApiVersion); + _backupVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", BackupVaultResource.ResourceType.Namespace, Diagnostics); + _backupVaultsRestClient = new BackupVaults(_backupVaultsClientDiagnostics, Pipeline, Endpoint, backupVaultApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NetAppAccountResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, NetAppAccountResource.ResourceType), id); + } + } + + /// + /// Create or update the specified Backup Vault in the NetApp account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Backup Vault. + /// BackupVault object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string backupVaultName, BackupVaultData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, BackupVaultData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupVaultOperationSource(Client), + _backupVaultsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the specified Backup Vault in the NetApp account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Backup Vault. + /// BackupVault object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string backupVaultName, BackupVaultData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, BackupVaultData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupVaultOperationSource(Client), + _backupVaultsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Backup Vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupVaultData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Backup Vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupVaultData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List and describe all Backup Vaults in the NetApp account. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new BackupVaultsGetByNetAppAccountAsyncCollectionResultOfT(_backupVaultsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new BackupVaultResource(Client, data)); + } + + /// List and describe all Backup Vaults in the NetApp account. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new BackupVaultsGetByNetAppAccountCollectionResultOfT(_backupVaultsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new BackupVaultResource(Client, data)); + } + + /// + /// Get the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Backup Vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Backup Vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Backup Vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Backup Vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BackupVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BackupVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultData.Serialization.cs new file mode 100644 index 000000000000..71db0bca2948 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultData.Serialization.cs @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Backup Vault information. + public partial class BackupVaultData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal BackupVaultData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupVaultData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (BackupVaultData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupVaultData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupVaultData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupVaultData DeserializeBackupVaultData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + BackupVaultProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BackupVaultProperties.DeserializeBackupVaultProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupVaultData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupVaultData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (BackupVaultData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupVaultData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupVaultData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BackupVaultData backupVaultData) + { + if (backupVaultData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(backupVaultData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static BackupVaultData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeBackupVaultData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultData.cs new file mode 100644 index 000000000000..4876996e173b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultData.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Backup Vault information. + public partial class BackupVaultData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public BackupVaultData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// Backup Vault Properties. + internal BackupVaultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, BackupVaultProperties properties) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// Backup Vault Properties. + internal BackupVaultProperties Properties { get; set; } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultResource.Serialization.cs new file mode 100644 index 000000000000..26d4c608effd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class BackupVaultResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new BackupVaultData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + BackupVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + BackupVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultResource.cs new file mode 100644 index 000000000000..0d43928605cc --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultResource.cs @@ -0,0 +1,716 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a BackupVault along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetBackupVaults method. + /// + public partial class BackupVaultResource : ArmResource + { + private readonly ClientDiagnostics _backupVaultsClientDiagnostics; + private readonly BackupVaults _backupVaultsRestClient; + private readonly BackupVaultData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/backupVaults"; + + /// Initializes a new instance of BackupVaultResource for mocking. + protected BackupVaultResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BackupVaultResource(ArmClient client, BackupVaultData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BackupVaultResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string backupVaultApiVersion); + _backupVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _backupVaultsRestClient = new BackupVaults(_backupVaultsClientDiagnostics, Pipeline, Endpoint, backupVaultApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual BackupVaultData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The backupVaultName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupVaultData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupVaultData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified NetApp Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Backup Vault object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, BackupVaultPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, BackupVaultPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupVaultOperationSource(Client), + _backupVaultsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified NetApp Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Backup Vault object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, BackupVaultPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, BackupVaultPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new BackupVaultOperationSource(Client), + _backupVaultsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_backupVaultsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// BackupVaults_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_backupVaultsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupVaultData.FromResponse(result), result); + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupVaultData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + BackupVaultPatch patch = new BackupVaultPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupVaultData.FromResponse(result), result); + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupVaultData current = Get(cancellationToken: cancellationToken).Value.Data; + BackupVaultPatch patch = new BackupVaultPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupVaultData.FromResponse(result), result); + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupVaultData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + BackupVaultPatch patch = new BackupVaultPatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupVaultData.FromResponse(result), result); + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupVaultData current = Get(cancellationToken: cancellationToken).Value.Data; + BackupVaultPatch patch = new BackupVaultPatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BackupVaultData.FromResponse(result), result); + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupVaultData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + BackupVaultPatch patch = new BackupVaultPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _backupVaultsClientDiagnostics.CreateScope("BackupVaultResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BackupVaultData.FromResponse(result), result); + return Response.FromValue(new BackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + BackupVaultData current = Get(cancellationToken: cancellationToken).Value.Data; + BackupVaultPatch patch = new BackupVaultPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a collection of Backups in the . + /// An object representing collection of Backups and their operations over a BackupResource. + public virtual BackupCollection GetBackups() + { + return GetCachedClient(client => new BackupCollection(client, Id)); + } + + /// Get the specified Backup under Backup Vault. + /// The name of the backup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + return await GetBackups().GetAsync(backupName, cancellationToken).ConfigureAwait(false); + } + + /// Get the specified Backup under Backup Vault. + /// The name of the backup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackup(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + return GetBackups().Get(backupName, cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultsGetByNetAppAccountAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultsGetByNetAppAccountAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..b7d33ac32175 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultsGetByNetAppAccountAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class BackupVaultsGetByNetAppAccountAsyncCollectionResultOfT : AsyncPageable + { + private readonly BackupVaults _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of BackupVaultsGetByNetAppAccountAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The BackupVaults client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public BackupVaultsGetByNetAppAccountAsyncCollectionResultOfT(BackupVaults client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of BackupVaultsGetByNetAppAccountAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of BackupVaultsGetByNetAppAccountAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + BackupVaultsList result = BackupVaultsList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByNetAppAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByNetAppAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("BackupVaultCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultsGetByNetAppAccountCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultsGetByNetAppAccountCollectionResultOfT.cs new file mode 100644 index 000000000000..4a3e5d92861d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupVaultsGetByNetAppAccountCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class BackupVaultsGetByNetAppAccountCollectionResultOfT : Pageable + { + private readonly BackupVaults _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of BackupVaultsGetByNetAppAccountCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The BackupVaults client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public BackupVaultsGetByNetAppAccountCollectionResultOfT(BackupVaults client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of BackupVaultsGetByNetAppAccountCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of BackupVaultsGetByNetAppAccountCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + BackupVaultsList result = BackupVaultsList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByNetAppAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByNetAppAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("BackupVaultCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupsGetByVaultAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupsGetByVaultAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..df05b0316e62 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupsGetByVaultAsyncCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class BackupsGetByVaultAsyncCollectionResultOfT : AsyncPageable + { + private readonly Backups _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _backupVaultName; + private readonly string _filter; + private readonly RequestContext _context; + + /// Initializes a new instance of BackupsGetByVaultAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Backups client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the Backup Vault. + /// An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public BackupsGetByVaultAsyncCollectionResultOfT(Backups client, Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _backupVaultName = backupVaultName; + _filter = filter; + _context = context; + } + + /// Gets the pages of BackupsGetByVaultAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of BackupsGetByVaultAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + BackupsList result = BackupsList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByVaultRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _backupVaultName, _filter, _context) : _client.CreateGetByVaultRequest(_subscriptionId, _resourceGroupName, _accountName, _backupVaultName, _filter, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("BackupCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupsGetByVaultCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupsGetByVaultCollectionResultOfT.cs new file mode 100644 index 000000000000..7ea8558e4d27 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BackupsGetByVaultCollectionResultOfT.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class BackupsGetByVaultCollectionResultOfT : Pageable + { + private readonly Backups _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _backupVaultName; + private readonly string _filter; + private readonly RequestContext _context; + + /// Initializes a new instance of BackupsGetByVaultCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Backups client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the Backup Vault. + /// An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public BackupsGetByVaultCollectionResultOfT(Backups client, Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _backupVaultName = backupVaultName; + _filter = filter; + _context = context; + } + + /// Gets the pages of BackupsGetByVaultCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of BackupsGetByVaultCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + BackupsList result = BackupsList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByVaultRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _backupVaultName, _filter, _context) : _client.CreateGetByVaultRequest(_subscriptionId, _resourceGroupName, _accountName, _backupVaultName, _filter, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("BackupCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketCollection.cs new file mode 100644 index 000000000000..5a400f28064a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketCollection.cs @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetBuckets method from an instance of the parent resource. + /// + public partial class BucketCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _bucketsClientDiagnostics; + private readonly Buckets _bucketsRestClient; + + /// Initializes a new instance of BucketCollection for mocking. + protected BucketCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BucketCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(BucketResource.ResourceType, out string bucketApiVersion); + _bucketsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", BucketResource.ResourceType.Namespace, Diagnostics); + _bucketsRestClient = new Buckets(_bucketsClientDiagnostics, Pipeline, Endpoint, bucketApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != VolumeResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, VolumeResource.ResourceType), id); + } + } + + /// + /// Creates or updates a bucket for a volume. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the bucket. + /// The bucket details including user details, and the volume path that should be mounted inside the bucket. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string bucketName, BucketData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, BucketData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new BucketOperationSource(Client), + _bucketsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a bucket for a volume. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the bucket. + /// The bucket details including user details, and the volume path that should be mounted inside the bucket. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string bucketName, BucketData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, BucketData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new BucketOperationSource(Client), + _bucketsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the bucket. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string bucketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BucketData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BucketResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the bucket. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string bucketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BucketData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BucketResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Describes all buckets belonging to a volume. Buckets allow additional services, such as AI services, connect to the volume data contained in those buckets. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new BucketsGetAllAsyncCollectionResultOfT( + _bucketsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new BucketResource(Client, data)); + } + + /// Describes all buckets belonging to a volume. Buckets allow additional services, such as AI services, connect to the volume data contained in those buckets. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new BucketsGetAllCollectionResultOfT( + _bucketsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new BucketResource(Client, data)); + } + + /// + /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the bucket. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string bucketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BucketData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BucketData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the bucket. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string bucketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BucketData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BucketData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the bucket. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string bucketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BucketData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BucketData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new BucketResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the bucket. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string bucketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(BucketData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((BucketData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new BucketResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketData.Serialization.cs new file mode 100644 index 000000000000..7c3a8d77f653 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketData.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Bucket resource. + public partial class BucketData : ResourceData, IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BucketData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (BucketData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBucketData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BucketData DeserializeBucketData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + BucketProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BucketProperties.DeserializeBucketProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BucketData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BucketData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BucketData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (BucketData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBucketData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BucketData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BucketData bucketData) + { + if (bucketData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(bucketData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static BucketData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeBucketData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketData.cs new file mode 100644 index 000000000000..1b0c54d1e159 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketData.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Bucket resource. + public partial class BucketData : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BucketData() + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Bucket properties. + internal BucketData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, BucketProperties properties) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// Bucket properties. + internal BucketProperties Properties { get; set; } + + /// The volume path mounted inside the bucket. The default is the root path '/' if no value is provided when the bucket is created. + public string Path + { + get + { + return Properties is null ? default : Properties.Path; + } + set + { + if (Properties is null) + { + Properties = new BucketProperties(); + } + Properties.Path = value; + } + } + + /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. + public FileSystemUser FileSystemUser + { + get + { + return Properties is null ? default : Properties.FileSystemUser; + } + set + { + if (Properties is null) + { + Properties = new BucketProperties(); + } + Properties.FileSystemUser = value; + } + } + + /// Provisioning state of the resource. + public Models.NetAppProvisioningState? ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// + /// The bucket credentials status. There states: + /// + /// "NoCredentialsSet": Access and Secret key pair have not been generated. + /// "CredentialsExpired": Access and Secret key pair have expired. + /// "Active": The certificate has been installed and credentials are unexpired. + /// + public CredentialsStatus? Status + { + get + { + return Properties is null ? default : Properties.Status; + } + } + + /// Properties of the server managing the lifecycle of volume buckets. + public BucketServerProperties Server + { + get + { + return Properties is null ? default : Properties.Server; + } + set + { + if (Properties is null) + { + Properties = new BucketProperties(); + } + Properties.Server = value; + } + } + + /// Access permissions for the bucket. Either ReadOnly or ReadWrite. The default is ReadOnly if no value is provided during bucket creation. + public BucketPermissions? Permissions + { + get + { + return Properties is null ? default : Properties.Permissions; + } + set + { + if (Properties is null) + { + Properties = new BucketProperties(); + } + Properties.Permissions = value.Value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketResource.Serialization.cs new file mode 100644 index 000000000000..6302d541d8be --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class BucketResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new BucketData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + BucketData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + BucketData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketResource.cs new file mode 100644 index 000000000000..6cfd0925e67a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketResource.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a Bucket along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetBuckets method. + /// + public partial class BucketResource : ArmResource + { + private readonly ClientDiagnostics _bucketsClientDiagnostics; + private readonly Buckets _bucketsRestClient; + private readonly BucketData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/buckets"; + + /// Initializes a new instance of BucketResource for mocking. + protected BucketResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BucketResource(ArmClient client, BucketData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BucketResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string bucketApiVersion); + _bucketsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _bucketsRestClient = new Buckets(_bucketsClientDiagnostics, Pipeline, Endpoint, bucketApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual BucketData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + /// The bucketName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BucketData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BucketResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BucketData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new BucketResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of a volume bucket. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The bucket details including user details, and the volume path that should be mounted inside the bucket. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, BucketPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BucketPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new BucketOperationSource(Client), + _bucketsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the details of a volume bucket. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The bucket details including user details, and the volume path that should be mounted inside the bucket. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, BucketPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BucketPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new BucketOperationSource(Client), + _bucketsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a volume's bucket. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_bucketsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a volume's bucket. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}. + /// + /// + /// Operation Id. + /// Buckets_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_bucketsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generate the access key and secret key used for accessing the specified volume bucket. Also return expiry date and time of key pair (in UTC). + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}/generateCredentials. + /// + /// + /// Operation Id. + /// Buckets_GenerateCredentials. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The bucket's Access and Secret key pair expiry time expressed as the number of days from now. + /// The cancellation token to use. + /// is null. + public virtual async Task> GenerateCredentialsAsync(BucketCredentialsExpiry body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketResource.GenerateCredentials"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateGenerateCredentialsRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BucketCredentialsExpiry.ToRequestContent(body), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(BucketGenerateCredentials.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generate the access key and secret key used for accessing the specified volume bucket. Also return expiry date and time of key pair (in UTC). + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}/generateCredentials. + /// + /// + /// Operation Id. + /// Buckets_GenerateCredentials. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The bucket's Access and Secret key pair expiry time expressed as the number of days from now. + /// The cancellation token to use. + /// is null. + public virtual Response GenerateCredentials(BucketCredentialsExpiry body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using DiagnosticScope scope = _bucketsClientDiagnostics.CreateScope("BucketResource.GenerateCredentials"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _bucketsRestClient.CreateGenerateCredentialsRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BucketCredentialsExpiry.ToRequestContent(body), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(BucketGenerateCredentials.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketsGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..4ef959dbf20e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class BucketsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Buckets _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of BucketsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Buckets client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public BucketsGetAllAsyncCollectionResultOfT(Buckets client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of BucketsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of BucketsGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + BucketList result = BucketList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("BucketCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketsGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..b35cc7bc8f6b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/BucketsGetAllCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class BucketsGetAllCollectionResultOfT : Pageable + { + private readonly Buckets _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of BucketsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Buckets client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public BucketsGetAllCollectionResultOfT(Buckets client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of BucketsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of BucketsGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + BucketList result = BucketList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("BucketCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheCollection.cs new file mode 100644 index 000000000000..0059ae92d65d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheCollection.cs @@ -0,0 +1,559 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetCaches method from an instance of the parent resource. + /// + public partial class CacheCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _cachesClientDiagnostics; + private readonly Caches _cachesRestClient; + + /// Initializes a new instance of CacheCollection for mocking. + protected CacheCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal CacheCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(CacheResource.ResourceType, out string cacheApiVersion); + _cachesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", CacheResource.ResourceType.Namespace, Diagnostics); + _cachesRestClient = new Caches(_cachesClientDiagnostics, Pipeline, Endpoint, cacheApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != CapacityPoolResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, CapacityPoolResource.ResourceType), id); + } + } + + /// + /// Create or update the specified cache within the capacity pool + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Cache. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string cacheName, CacheData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, cacheName, CacheData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new CacheOperationSource(Client), + _cachesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the specified cache within the capacity pool + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Cache. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string cacheName, CacheData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, cacheName, CacheData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new CacheOperationSource(Client), + _cachesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified Cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Cache. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, cacheName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CacheData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified Cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Cache. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, cacheName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CacheData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all caches within the capacity pool. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new CachesGetByCapacityPoolsAsyncCollectionResultOfT( + _cachesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new CacheResource(Client, data)); + } + + /// List all caches within the capacity pool. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new CachesGetByCapacityPoolsCollectionResultOfT( + _cachesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new CacheResource(Client, data)); + } + + /// + /// Get the details of the specified Cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Cache. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, cacheName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(CacheData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((CacheData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified Cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Cache. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, cacheName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(CacheData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((CacheData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified Cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Cache. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, cacheName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(CacheData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((CacheData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified Cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Cache. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, cacheName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(CacheData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((CacheData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheData.Serialization.cs new file mode 100644 index 000000000000..913264b92cc6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheData.Serialization.cs @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Cache resource. + public partial class CacheData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal CacheData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CacheData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (string item in Zones) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + CacheData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (CacheData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CacheData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCacheData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CacheData DeserializeCacheData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + CacheProperties properties = default; + string eTag = default; + IList zones = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = CacheProperties.DeserializeCacheProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("etag"u8)) + { + eTag = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("zones"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + zones = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CacheData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + eTag, + zones ?? new ChangeTrackingList()); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(CacheData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + CacheData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (CacheData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeCacheData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CacheData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(CacheData cacheData) + { + if (cacheData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(cacheData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static CacheData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeCacheData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheData.cs new file mode 100644 index 000000000000..be62e779cce0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheData.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Cache resource. + public partial class CacheData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// is null. + public CacheData(AzureLocation location, CacheProperties properties) : base(location) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + Zones = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + /// The availability zones. + internal CacheData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, CacheProperties properties, string eTag, IList zones) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; + Zones = zones; + } + + /// The resource-specific properties for this resource. + public CacheProperties Properties { get; set; } + + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + public string ETag { get; } + + /// The availability zones. + public IList Zones { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheResource.Serialization.cs new file mode 100644 index 000000000000..4f7487179770 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class CacheResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new CacheData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + CacheData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + CacheData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheResource.cs new file mode 100644 index 000000000000..264b776921e2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CacheResource.cs @@ -0,0 +1,874 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a Cache along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetCaches method. + /// + public partial class CacheResource : ArmResource + { + private readonly ClientDiagnostics _cachesClientDiagnostics; + private readonly Caches _cachesRestClient; + private readonly CacheData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/caches"; + + /// Initializes a new instance of CacheResource for mocking. + protected CacheResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal CacheResource(ArmClient client, CacheData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal CacheResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string cacheApiVersion); + _cachesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _cachesRestClient = new Caches(_cachesClientDiagnostics, Pipeline, Endpoint, cacheApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual CacheData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The cacheName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string cacheName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the details of the specified Cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CacheData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified Cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CacheData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task UpdateAsync(WaitUntil waitUntil, CachePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, CachePatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_cachesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, CachePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, CachePatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_cachesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_cachesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified cache + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}. + /// + /// + /// Operation Id. + /// Caches_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_cachesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This operation will list the cluster peering command, cluster peering passphrase and the vserver peering command + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}/listPeeringPassphrases. + /// + /// + /// Operation Id. + /// Caches_ListPeeringPassphrases. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetPeeringPassphrasesAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.GetPeeringPassphrases"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetPeeringPassphrasesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(PeeringPassphrases.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This operation will list the cluster peering command, cluster peering passphrase and the vserver peering command + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}/listPeeringPassphrases. + /// + /// + /// Operation Id. + /// Caches_ListPeeringPassphrases. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetPeeringPassphrases(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.GetPeeringPassphrases"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetPeeringPassphrasesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(PeeringPassphrases.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Moves cache to another pool + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}/poolChange. + /// + /// + /// Operation Id. + /// Caches_PoolChange. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Move cache to the pool supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task PoolChangeAsync(WaitUntil waitUntil, PoolChangeRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.PoolChange"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreatePoolChangeRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, PoolChangeRequest.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_cachesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Moves cache to another pool + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/caches/{cacheName}/poolChange. + /// + /// + /// Operation Id. + /// Caches_PoolChange. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Move cache to the pool supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation PoolChange(WaitUntil waitUntil, PoolChangeRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.PoolChange"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreatePoolChangeRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, PoolChangeRequest.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_cachesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CacheData.FromResponse(result), result); + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + else + { + CacheData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + CachePatch patch = new CachePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CacheData.FromResponse(result), result); + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + else + { + CacheData current = Get(cancellationToken: cancellationToken).Value.Data; + CachePatch patch = new CachePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CacheData.FromResponse(result), result); + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + else + { + CacheData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + CachePatch patch = new CachePatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CacheData.FromResponse(result), result); + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + else + { + CacheData current = Get(cancellationToken: cancellationToken).Value.Data; + CachePatch patch = new CachePatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CacheData.FromResponse(result), result); + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + else + { + CacheData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + CachePatch patch = new CachePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _cachesClientDiagnostics.CreateScope("CacheResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _cachesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CacheData.FromResponse(result), result); + return Response.FromValue(new CacheResource(Client, response.Value), response.GetRawResponse()); + } + else + { + CacheData current = Get(cancellationToken: cancellationToken).Value.Data; + CachePatch patch = new CachePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CachesGetByCapacityPoolsAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CachesGetByCapacityPoolsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..7f14750f3214 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CachesGetByCapacityPoolsAsyncCollectionResultOfT.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class CachesGetByCapacityPoolsAsyncCollectionResultOfT : AsyncPageable + { + private readonly Caches _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly RequestContext _context; + + /// Initializes a new instance of CachesGetByCapacityPoolsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Caches client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public CachesGetByCapacityPoolsAsyncCollectionResultOfT(Caches client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _context = context; + } + + /// Gets the pages of CachesGetByCapacityPoolsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of CachesGetByCapacityPoolsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + CacheList result = CacheList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByCapacityPoolsRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _context) : _client.CreateGetByCapacityPoolsRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("CacheCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CachesGetByCapacityPoolsCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CachesGetByCapacityPoolsCollectionResultOfT.cs new file mode 100644 index 000000000000..2ed6e3ea8abe --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CachesGetByCapacityPoolsCollectionResultOfT.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class CachesGetByCapacityPoolsCollectionResultOfT : Pageable + { + private readonly Caches _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly RequestContext _context; + + /// Initializes a new instance of CachesGetByCapacityPoolsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Caches client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public CachesGetByCapacityPoolsCollectionResultOfT(Caches client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _context = context; + } + + /// Gets the pages of CachesGetByCapacityPoolsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of CachesGetByCapacityPoolsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + CacheList result = CacheList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByCapacityPoolsRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _context) : _client.CreateGetByCapacityPoolsRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("CacheCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolCollection.cs index 764bf1745e6b..c6ef9b60ab9e 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolCollection.cs @@ -8,67 +8,66 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.NetApp { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetCapacityPools method from an instance of . + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetCapacityPools method from an instance of the parent resource. /// public partial class CapacityPoolCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _capacityPoolPoolsClientDiagnostics; - private readonly PoolsRestOperations _capacityPoolPoolsRestClient; + private readonly ClientDiagnostics _poolsClientDiagnostics; + private readonly Pools _poolsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of CapacityPoolCollection for mocking. protected CapacityPoolCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal CapacityPoolCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _capacityPoolPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", CapacityPoolResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(CapacityPoolResource.ResourceType, out string capacityPoolPoolsApiVersion); - _capacityPoolPoolsRestClient = new PoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, capacityPoolPoolsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(CapacityPoolResource.ResourceType, out string capacityPoolApiVersion); + _poolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", CapacityPoolResource.ResourceType.Namespace, Diagnostics); + _poolsRestClient = new Pools(_poolsClientDiagnostics, Pipeline, Endpoint, capacityPoolApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != NetAppAccountResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetAppAccountResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, NetAppAccountResource.ResourceType), id); + } } /// /// Create or Update a capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Operation Id - /// Pools_CreateOrUpdate + /// Operation Id. + /// CapacityPools_CreateOrUpdate. /// /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// @@ -76,21 +75,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the capacity pool. /// Capacity pool object supplied in the body of the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string poolName, CapacityPoolData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolCollection.CreateOrUpdate"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _capacityPoolPoolsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new CapacityPoolOperationSource(Client), _capacityPoolPoolsClientDiagnostics, Pipeline, _capacityPoolPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, CapacityPoolData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new CapacityPoolOperationSource(Client), + _poolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -104,20 +116,16 @@ public virtual async Task> CreateOrUpdateAsyn /// Create or Update a capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// CapacityPools_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// @@ -125,21 +133,34 @@ public virtual async Task> CreateOrUpdateAsyn /// The name of the capacity pool. /// Capacity pool object supplied in the body of the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string poolName, CapacityPoolData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolCollection.CreateOrUpdate"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolCollection.CreateOrUpdate"); scope.Start(); try { - var response = _capacityPoolPoolsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, data, cancellationToken); - var operation = new NetAppArmOperation(new CapacityPoolOperationSource(Client), _capacityPoolPoolsClientDiagnostics, Pipeline, _capacityPoolPoolsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, CapacityPoolData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new CapacityPoolOperationSource(Client), + _poolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -153,38 +174,42 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitU /// Get details of the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// CapacityPools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the capacity pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string poolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolCollection.Get"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolCollection.Get"); scope.Start(); try { - var response = await _capacityPoolPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CapacityPoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -198,38 +223,42 @@ public virtual async Task> GetAsync(string poolNa /// Get details of the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// CapacityPools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the capacity pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string poolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolCollection.Get"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolCollection.Get"); scope.Start(); try { - var response = _capacityPoolPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CapacityPoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -239,100 +268,78 @@ public virtual Response Get(string poolName, CancellationT } } - /// - /// List all capacity pools in the NetApp Account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools - /// - /// - /// Operation Id - /// Pools_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// List all capacity pools in the NetApp Account. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _capacityPoolPoolsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _capacityPoolPoolsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new CapacityPoolResource(Client, CapacityPoolData.DeserializeCapacityPoolData(e)), _capacityPoolPoolsClientDiagnostics, Pipeline, "CapacityPoolCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new PoolsGetAllAsyncCollectionResultOfT(_poolsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new CapacityPoolResource(Client, data)); } - /// - /// List all capacity pools in the NetApp Account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools - /// - /// - /// Operation Id - /// Pools_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// List all capacity pools in the NetApp Account. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _capacityPoolPoolsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _capacityPoolPoolsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CapacityPoolResource(Client, CapacityPoolData.DeserializeCapacityPoolData(e)), _capacityPoolPoolsClientDiagnostics, Pipeline, "CapacityPoolCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new PoolsGetAllCollectionResultOfT(_poolsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new CapacityPoolResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Get details of the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Operation Id - /// Pools_Get + /// Operation Id. + /// CapacityPools_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the capacity pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string poolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolCollection.Exists"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolCollection.Exists"); scope.Start(); try { - var response = await _capacityPoolPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(CapacityPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((CapacityPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -343,39 +350,53 @@ public virtual async Task> ExistsAsync(string poolName, Cancellat } /// - /// Checks to see if the resource exists in azure. + /// Get details of the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// CapacityPools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the capacity pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string poolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolCollection.Exists"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolCollection.Exists"); scope.Start(); try { - var response = _capacityPoolPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(CapacityPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((CapacityPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -386,41 +407,57 @@ public virtual Response Exists(string poolName, CancellationToken cancella } /// - /// Tries to get details for this resource from the service. + /// Get details of the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// CapacityPools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the capacity pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string poolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolCollection.GetIfExists"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolCollection.GetIfExists"); scope.Start(); try { - var response = await _capacityPoolPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(CapacityPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((CapacityPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -431,41 +468,57 @@ public virtual async Task> GetIfExistsAsy } /// - /// Tries to get details for this resource from the service. + /// Get details of the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// CapacityPools_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the capacity pool. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string poolName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolCollection.GetIfExists"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolCollection.GetIfExists"); scope.Start(); try { - var response = _capacityPoolPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, poolName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(CapacityPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((CapacityPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -485,6 +538,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolData.Serialization.cs index 6cae01899e7c..34b40706f0eb 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolData.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolData.Serialization.cs @@ -10,16 +10,23 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - public partial class CapacityPoolData : IUtf8JsonSerializable, IJsonModel + /// Capacity pool resource. + public partial class CapacityPoolData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal CapacityPoolData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,297 +38,149 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CapacityPoolData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); - writer.WriteStringValue(ETag.Value.ToString()); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(PoolId)) - { - writer.WritePropertyName("poolId"u8); - writer.WriteStringValue(PoolId.Value); - } - writer.WritePropertyName("size"u8); - writer.WriteNumberValue(Size); - writer.WritePropertyName("serviceLevel"u8); - writer.WriteStringValue(ServiceLevel.ToString()); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(TotalThroughputMibps)) - { - writer.WritePropertyName("totalThroughputMibps"u8); - writer.WriteNumberValue(TotalThroughputMibps.Value); - } - if (options.Format != "W" && Optional.IsDefined(UtilizedThroughputMibps)) - { - writer.WritePropertyName("utilizedThroughputMibps"u8); - writer.WriteNumberValue(UtilizedThroughputMibps.Value); - } - if (Optional.IsDefined(CustomThroughputMibps)) - { - if (CustomThroughputMibps != null) - { - writer.WritePropertyName("customThroughputMibps"u8); - writer.WriteNumberValue(CustomThroughputMibps.Value); - } - else - { - writer.WriteNull("customThroughputMibps"); - } - } - if (Optional.IsDefined(QosType)) - { - writer.WritePropertyName("qosType"u8); - writer.WriteStringValue(QosType.Value.ToString()); - } - if (Optional.IsDefined(IsCoolAccessEnabled)) - { - writer.WritePropertyName("coolAccess"u8); - writer.WriteBooleanValue(IsCoolAccessEnabled.Value); - } - if (Optional.IsDefined(EncryptionType)) - { - if (EncryptionType != null) - { - writer.WritePropertyName("encryptionType"u8); - writer.WriteStringValue(EncryptionType.Value.ToString()); - } - else - { - writer.WriteNull("encryptionType"); - } + writer.WriteStringValue(ETag); } - writer.WriteEndObject(); } - CapacityPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + CapacityPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (CapacityPoolData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CapacityPoolData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeCapacityPoolData(document.RootElement, options); } - internal static CapacityPoolData DeserializeCapacityPoolData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CapacityPoolData DeserializeCapacityPoolData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - ETag? etag = default; - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - Guid? poolId = default; - long size = default; - NetAppFileServiceLevel serviceLevel = default; - string provisioningState = default; - float? totalThroughputMibps = default; - float? utilizedThroughputMibps = default; - float? customThroughputMibps = default; - CapacityPoolQosType? qosType = default; - bool? coolAccess = default; - CapacityPoolEncryptionType? encryptionType = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + PoolProperties properties = default; + string eTag = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("etag"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - etag = new ETag(property.Value.GetString()); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("name"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("poolId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - poolId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("size"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - size = property0.Value.GetInt64(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("serviceLevel"u8)) + else { - serviceLevel = new NetAppFileServiceLevel(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("totalThroughputMibps"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - totalThroughputMibps = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("utilizedThroughputMibps"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - utilizedThroughputMibps = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("customThroughputMibps"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - customThroughputMibps = null; - continue; - } - customThroughputMibps = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("qosType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - qosType = new CapacityPoolQosType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("coolAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccess = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("encryptionType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - encryptionType = null; - continue; - } - encryptionType = new CapacityPoolEncryptionType(property0.Value.GetString()); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = PoolProperties.DeserializePoolProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("etag"u8)) + { + eTag = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new CapacityPoolData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, tags ?? new ChangeTrackingDictionary(), location, - etag, - poolId, - size, - serviceLevel, - provisioningState, - totalThroughputMibps, - utilizedThroughputMibps, - customThroughputMibps, - qosType, - coolAccess, - encryptionType, - serializedAdditionalRawData); + properties, + eTag); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -331,15 +190,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op } } - CapacityPoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + CapacityPoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (CapacityPoolData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeCapacityPoolData(document.RootElement, options); } default: @@ -347,6 +211,27 @@ CapacityPoolData IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(CapacityPoolData capacityPoolData) + { + if (capacityPoolData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(capacityPoolData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static CapacityPoolData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeCapacityPoolData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolData.cs index a635751ec4cb..4e2cb0881fca 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolData.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolData.cs @@ -13,115 +13,182 @@ namespace Azure.ResourceManager.NetApp { - /// - /// A class representing the CapacityPool data model. - /// Capacity pool resource - /// + /// Capacity pool resource. public partial class CapacityPoolData : TrackedResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. + /// The geo-location where the resource lives. /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). /// The service level of the file system. public CapacityPoolData(AzureLocation location, long size, NetAppFileServiceLevel serviceLevel) : base(location) { + Size = size; ServiceLevel = serviceLevel; } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// UUID v4 used to identify the Pool. - /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). - /// The service level of the file system. - /// Azure lifecycle management. - /// Total throughput of pool in MiB/s. - /// Utilized throughput of pool in MiB/s. - /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. - /// The qos type of the pool. - /// If enabled (true) the pool can contain cool Access enabled volumes. - /// Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. - /// Keeps track of any properties unknown to the library. - internal CapacityPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, Guid? poolId, long size, NetAppFileServiceLevel serviceLevel, string provisioningState, float? totalThroughputMibps, float? utilizedThroughputMibps, float? customThroughputMibps, CapacityPoolQosType? qosType, bool? isCoolAccessEnabled, CapacityPoolEncryptionType? encryptionType, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// Capacity pool properties. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + internal CapacityPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, PoolProperties properties, string eTag) : base(id, name, resourceType, systemData, tags, location) { - ETag = etag; - PoolId = poolId; - Size = size; - ServiceLevel = serviceLevel; - ProvisioningState = provisioningState; - TotalThroughputMibps = totalThroughputMibps; - UtilizedThroughputMibps = utilizedThroughputMibps; - CustomThroughputMibps = customThroughputMibps; - QosType = qosType; - IsCoolAccessEnabled = isCoolAccessEnabled; - EncryptionType = encryptionType; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; } - /// Initializes a new instance of for deserialization. - internal CapacityPoolData() + /// Capacity pool properties. + internal PoolProperties Properties { get; set; } + + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + public string ETag { get; } + + /// UUID v4 used to identify the Pool. + public string PoolId { + get + { + return Properties is null ? default : Properties.PoolId; + } } - /// A unique read-only string that changes whenever the resource is updated. - public ETag? ETag { get; } - /// UUID v4 used to identify the Pool. - public Guid? PoolId { get; } /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). - public long Size { get; set; } + public long Size + { + get + { + return Properties is null ? default : Properties.Size; + } + set + { + if (Properties is null) + { + Properties = new PoolProperties(); + } + Properties.Size = value; + } + } + /// The service level of the file system. - public NetAppFileServiceLevel ServiceLevel { get; set; } + public NetAppFileServiceLevel ServiceLevel + { + get + { + return Properties is null ? default : Properties.ServiceLevel; + } + set + { + if (Properties is null) + { + Properties = new PoolProperties(); + } + Properties.ServiceLevel = value; + } + } + /// Azure lifecycle management. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// Total throughput of pool in MiB/s. - public float? TotalThroughputMibps { get; } + public float? TotalThroughputMibps + { + get + { + return Properties is null ? default : Properties.TotalThroughputMibps; + } + } + /// Utilized throughput of pool in MiB/s. - public float? UtilizedThroughputMibps { get; } + public float? UtilizedThroughputMibps + { + get + { + return Properties is null ? default : Properties.UtilizedThroughputMibps; + } + } + /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. - public float? CustomThroughputMibps { get; set; } + public int? CustomThroughputMibps + { + get + { + return Properties is null ? default : Properties.CustomThroughputMibps; + } + set + { + if (Properties is null) + { + Properties = new PoolProperties(); + } + Properties.CustomThroughputMibps = value.Value; + } + } + /// The qos type of the pool. - public CapacityPoolQosType? QosType { get; set; } + public QosType? QosType + { + get + { + return Properties is null ? default : Properties.QosType; + } + set + { + if (Properties is null) + { + Properties = new PoolProperties(); + } + Properties.QosType = value.Value; + } + } + /// If enabled (true) the pool can contain cool Access enabled volumes. - public bool? IsCoolAccessEnabled { get; set; } + public bool? CoolAccess + { + get + { + return Properties is null ? default : Properties.CoolAccess; + } + set + { + if (Properties is null) + { + Properties = new PoolProperties(); + } + Properties.CoolAccess = value.Value; + } + } + /// Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. - public CapacityPoolEncryptionType? EncryptionType { get; set; } + public CapacityPoolEncryptionType? EncryptionType + { + get + { + return Properties is null ? default : Properties.EncryptionType; + } + set + { + if (Properties is null) + { + Properties = new PoolProperties(); + } + Properties.EncryptionType = value.Value; + } + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.Serialization.cs index 7cfdc1e5a646..90d172ccbb27 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.NetApp { + /// public partial class CapacityPoolResource : IJsonModel { - private static CapacityPoolData s_dataDeserializationInstance; - private static CapacityPoolData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new CapacityPoolData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - CapacityPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + CapacityPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. CapacityPoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs index 1aad32052ac8..c5b349d54ab7 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs @@ -7,47 +7,37 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NetApp { /// - /// A Class representing a CapacityPool along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetCapacityPoolResource method. - /// Otherwise you can get one from its parent resource using the GetCapacityPool method. + /// A class representing a CapacityPool along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetCapacityPools method. /// public partial class CapacityPoolResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The poolName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _capacityPoolPoolsClientDiagnostics; - private readonly PoolsRestOperations _capacityPoolPoolsRestClient; + private readonly ClientDiagnostics _poolsClientDiagnostics; + private readonly Pools _poolsRestClient; private readonly CapacityPoolData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of CapacityPoolResource for mocking. protected CapacityPoolResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal CapacityPoolResource(ArmClient client, CapacityPoolData data) : this(client, data.Id) @@ -56,140 +46,93 @@ internal CapacityPoolResource(ArmClient client, CapacityPoolData data) : this(cl _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal CapacityPoolResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _capacityPoolPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string capacityPoolPoolsApiVersion); - _capacityPoolPoolsRestClient = new PoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, capacityPoolPoolsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string capacityPoolApiVersion); + _poolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _poolsRestClient = new Pools(_poolsClientDiagnostics, Pipeline, Endpoint, capacityPoolApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); } /// Gets whether or not the current instance has data. public virtual bool HasData { get; } /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. public virtual CapacityPoolData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// Gets a collection of NetAppVolumeResources in the CapacityPool. - /// An object representing collection of NetAppVolumeResources and their operations over a NetAppVolumeResource. - public virtual NetAppVolumeCollection GetNetAppVolumes() - { - return GetCachedClient(client => new NetAppVolumeCollection(client, Id)); - } - - /// - /// Get the details of the specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volume. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetNetAppVolumeAsync(string volumeName, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName) { - return await GetNetAppVolumes().GetAsync(volumeName, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}"; + return new ResourceIdentifier(resourceId); } - /// - /// Get the details of the specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volume. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetNetAppVolume(string volumeName, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetNetAppVolumes().Get(volumeName, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get details of the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Operation Id - /// Pools_Get + /// Operation Id. + /// CapacityPools_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.Get"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.Get"); scope.Start(); try { - var response = await _capacityPoolPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CapacityPoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -203,33 +146,41 @@ public virtual async Task> GetAsync(CancellationT /// Get details of the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Operation Id - /// Pools_Get + /// Operation Id. + /// CapacityPools_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.Get"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.Get"); scope.Start(); try { - var response = _capacityPoolPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CapacityPoolData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -240,38 +191,55 @@ public virtual Response Get(CancellationToken cancellation } /// - /// Delete the specified capacity pool + /// Patch the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Operation Id - /// Pools_Delete + /// Operation Id. + /// CapacityPools_Update. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Capacity pool object supplied in the body of the operation. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, CapacityPoolPatch patch, CancellationToken cancellationToken = default) { - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.Update"); scope.Start(); try { - var response = await _capacityPoolPoolsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_capacityPoolPoolsClientDiagnostics, Pipeline, _capacityPoolPoolsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, CapacityPoolPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new CapacityPoolOperationSource(Client), + _poolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -282,38 +250,55 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete the specified capacity pool + /// Patch the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Operation Id - /// Pools_Delete + /// Operation Id. + /// CapacityPools_Update. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Capacity pool object supplied in the body of the operation. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, CapacityPoolPatch patch, CancellationToken cancellationToken = default) { - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.Update"); scope.Start(); try { - var response = _capacityPoolPoolsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_capacityPoolPoolsClientDiagnostics, Pipeline, _capacityPoolPoolsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, CapacityPoolPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new CapacityPoolOperationSource(Client), + _poolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + { + operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -324,42 +309,45 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Patch the specified capacity pool + /// Delete the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Operation Id - /// Pools_Update + /// Operation Id. + /// CapacityPools_Delete. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Capacity pool object supplied in the body of the operation. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, CapacityPoolPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.Update"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.Delete"); scope.Start(); try { - var response = await _capacityPoolPoolsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new CapacityPoolOperationSource(Client), _capacityPoolPoolsClientDiagnostics, Pipeline, _capacityPoolPoolsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_poolsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -370,42 +358,45 @@ public virtual async Task> UpdateAsync(WaitUn } /// - /// Patch the specified capacity pool + /// Delete the specified capacity pool /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}. /// /// - /// Operation Id - /// Pools_Update + /// Operation Id. + /// CapacityPools_Delete. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Capacity pool object supplied in the body of the operation. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, CapacityPoolPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.Update"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.Delete"); scope.Start(); try { - var response = _capacityPoolPoolsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new NetAppArmOperation(new CapacityPoolOperationSource(Client), _capacityPoolPoolsClientDiagnostics, Pipeline, _capacityPoolPoolsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_poolsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + { + operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -415,27 +406,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, Ca } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -445,28 +416,34 @@ public virtual async Task> AddTagAsync(string key Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.AddTag"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.AddTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _capacityPoolPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new CapacityPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CapacityPoolData.FromResponse(result), result); + return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new CapacityPoolPatch(current.Location); - foreach (var tag in current.Tags) + CapacityPoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + CapacityPoolPatch patch = new CapacityPoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -477,27 +454,7 @@ public virtual async Task> AddTagAsync(string key } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -507,28 +464,34 @@ public virtual Response AddTag(string key, string value, C Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.AddTag"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.AddTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _capacityPoolPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new CapacityPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CapacityPoolData.FromResponse(result), result); + return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new CapacityPoolPatch(current.Location); - foreach (var tag in current.Tags) + CapacityPoolData current = Get(cancellationToken: cancellationToken).Value.Data; + CapacityPoolPatch patch = new CapacityPoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -539,53 +502,39 @@ public virtual Response AddTag(string key, string value, C } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.SetTags"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.SetTags"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _capacityPoolPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new CapacityPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CapacityPoolData.FromResponse(result), result); + return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new CapacityPoolPatch(current.Location); + CapacityPoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + CapacityPoolPatch patch = new CapacityPoolPatch(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -596,53 +545,39 @@ public virtual async Task> SetTagsAsync(IDictiona } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.SetTags"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.SetTags"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _capacityPoolPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new CapacityPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CapacityPoolData.FromResponse(result), result); + return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new CapacityPoolPatch(current.Location); + CapacityPoolData current = Get(cancellationToken: cancellationToken).Value.Data; + CapacityPoolPatch patch = new CapacityPoolPatch(); patch.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -653,27 +588,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -681,28 +596,34 @@ public virtual async Task> RemoveTagAsync(string { Argument.AssertNotNull(key, nameof(key)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.RemoveTag"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.RemoveTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _capacityPoolPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new CapacityPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CapacityPoolData.FromResponse(result), result); + return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new CapacityPoolPatch(current.Location); - foreach (var tag in current.Tags) + CapacityPoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + CapacityPoolPatch patch = new CapacityPoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -713,27 +634,7 @@ public virtual async Task> RemoveTagAsync(string } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -741,28 +642,34 @@ public virtual Response RemoveTag(string key, Cancellation { Argument.AssertNotNull(key, nameof(key)); - using var scope = _capacityPoolPoolsClientDiagnostics.CreateScope("CapacityPoolResource.RemoveTag"); + using DiagnosticScope scope = _poolsClientDiagnostics.CreateScope("CapacityPoolResource.RemoveTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _capacityPoolPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new CapacityPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _poolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CapacityPoolData.FromResponse(result), result); + return Response.FromValue(new CapacityPoolResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new CapacityPoolPatch(current.Location); - foreach (var tag in current.Tags) + CapacityPoolData current = Get(cancellationToken: cancellationToken).Value.Data; + CapacityPoolPatch patch = new CapacityPoolPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -772,5 +679,71 @@ public virtual Response RemoveTag(string key, Cancellation throw; } } + + /// Gets a collection of Volumes in the . + /// An object representing collection of Volumes and their operations over a VolumeResource. + public virtual VolumeCollection GetVolumes() + { + return GetCachedClient(client => new VolumeCollection(client, Id)); + } + + /// Get the details of the specified volume. + /// The name of the volume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVolumeAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + return await GetVolumes().GetAsync(volumeName, cancellationToken).ConfigureAwait(false); + } + + /// Get the details of the specified volume. + /// The name of the volume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVolume(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + return GetVolumes().Get(volumeName, cancellationToken); + } + + /// Gets a collection of Caches in the . + /// An object representing collection of Caches and their operations over a CacheResource. + public virtual CacheCollection GetCaches() + { + return GetCachedClient(client => new CacheCollection(client, Id)); + } + + /// Get the details of the specified Cache. + /// The name of the Cache. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCacheAsync(string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + return await GetCaches().GetAsync(cacheName, cancellationToken).ConfigureAwait(false); + } + + /// Get the details of the specified Cache. + /// The name of the Cache. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCache(string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + return GetCaches().Get(cacheName, cancellationToken); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountCollection.cs new file mode 100644 index 000000000000..60f5dd3ae3aa --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountCollection.cs @@ -0,0 +1,548 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetElasticAccounts method from an instance of the parent resource. + /// + public partial class ElasticAccountCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _elasticAccountsClientDiagnostics; + private readonly ElasticAccounts _elasticAccountsRestClient; + + /// Initializes a new instance of ElasticAccountCollection for mocking. + protected ElasticAccountCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticAccountCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ElasticAccountResource.ResourceType, out string elasticAccountApiVersion); + _elasticAccountsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ElasticAccountResource.ResourceType.Namespace, Diagnostics); + _elasticAccountsRestClient = new ElasticAccounts(_elasticAccountsClientDiagnostics, Pipeline, Endpoint, elasticAccountApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } + } + + /// + /// Create or update the specified NetApp elastic account within the resource group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticAccount. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string accountName, ElasticAccountData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, ElasticAccountData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticAccountOperationSource(Client), + _elasticAccountsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the specified NetApp elastic account within the resource group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticAccount. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string accountName, ElasticAccountData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, ElasticAccountData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticAccountOperationSource(Client), + _elasticAccountsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List and describe all NetApp elastic accounts in the resource group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ElasticAccountsGetByResourceGroupAsyncCollectionResultOfT(_elasticAccountsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new ElasticAccountResource(Client, data)); + } + + /// List and describe all NetApp elastic accounts in the resource group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ElasticAccountsGetByResourceGroupCollectionResultOfT(_elasticAccountsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new ElasticAccountResource(Client, data)); + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticAccountData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticAccountData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticAccountData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticAccountData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountData.Serialization.cs new file mode 100644 index 000000000000..5db641c6646d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountData.Serialization.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp elastic account resource. + public partial class ElasticAccountData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticAccountData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticAccountData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + ((IJsonModel)Identity).Write(writer, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticAccountData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ElasticAccountData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticAccountData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticAccountData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticAccountData DeserializeElasticAccountData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + ElasticAccountProperties properties = default; + string eTag = default; + ManagedServiceIdentity identity = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticAccountProperties.DeserializeElasticAccountProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("eTag"u8)) + { + eTag = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("identity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticAccountData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + eTag, + identity); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticAccountData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticAccountData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ElasticAccountData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticAccountData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticAccountData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticAccountData elasticAccountData) + { + if (elasticAccountData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticAccountData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ElasticAccountData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticAccountData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountData.cs new file mode 100644 index 000000000000..385129f9938e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountData.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp elastic account resource. + public partial class ElasticAccountData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public ElasticAccountData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The managed service identities assigned to this resource. + internal ElasticAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, ElasticAccountProperties properties, string eTag, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; + Identity = identity; + } + + /// The resource-specific properties for this resource. + public ElasticAccountProperties Properties { get; set; } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + public string ETag { get; } + + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountResource.Serialization.cs new file mode 100644 index 000000000000..a6c1a8b2bc2e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class ElasticAccountResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ElasticAccountData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ElasticAccountData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + ElasticAccountData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountResource.cs new file mode 100644 index 000000000000..407700fa193c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountResource.cs @@ -0,0 +1,814 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a ElasticAccount along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetElasticAccounts method. + /// + public partial class ElasticAccountResource : ArmResource + { + private readonly ClientDiagnostics _elasticAccountsClientDiagnostics; + private readonly ElasticAccounts _elasticAccountsRestClient; + private readonly ElasticAccountData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/elasticAccounts"; + + /// Initializes a new instance of ElasticAccountResource for mocking. + protected ElasticAccountResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ElasticAccountResource(ArmClient client, ElasticAccountData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticAccountResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string elasticAccountApiVersion); + _elasticAccountsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _elasticAccountsRestClient = new ElasticAccounts(_elasticAccountsClientDiagnostics, Pipeline, Endpoint, elasticAccountApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual ElasticAccountData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticAccountPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, ElasticAccountPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticAccountOperationSource(Client), + _elasticAccountsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticAccountPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, ElasticAccountPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticAccountOperationSource(Client), + _elasticAccountsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_elasticAccountsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_elasticAccountsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticAccountData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticAccountPatch patch = new ElasticAccountPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticAccountData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticAccountPatch patch = new ElasticAccountPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticAccountData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticAccountPatch patch = new ElasticAccountPatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticAccountData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticAccountPatch patch = new ElasticAccountPatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticAccountData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticAccountPatch patch = new ElasticAccountPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticAccountsClientDiagnostics.CreateScope("ElasticAccountResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticAccountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticAccountData.FromResponse(result), result); + return Response.FromValue(new ElasticAccountResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticAccountData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticAccountPatch patch = new ElasticAccountPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a collection of ElasticCapacityPools in the . + /// An object representing collection of ElasticCapacityPools and their operations over a ElasticCapacityPoolResource. + public virtual ElasticCapacityPoolCollection GetElasticCapacityPools() + { + return GetCachedClient(client => new ElasticCapacityPoolCollection(client, Id)); + } + + /// Get the NetApp elastic account. + /// The name of the ElasticCapacityPool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetElasticCapacityPoolAsync(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + return await GetElasticCapacityPools().GetAsync(poolName, cancellationToken).ConfigureAwait(false); + } + + /// Get the NetApp elastic account. + /// The name of the ElasticCapacityPool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetElasticCapacityPool(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + return GetElasticCapacityPools().Get(poolName, cancellationToken); + } + + /// Gets a collection of ElasticSnapshotPolicies in the . + /// An object representing collection of ElasticSnapshotPolicies and their operations over a ElasticSnapshotPolicyResource. + public virtual ElasticSnapshotPolicyCollection GetElasticSnapshotPolicies() + { + return GetCachedClient(client => new ElasticSnapshotPolicyCollection(client, Id)); + } + + /// Get a ElasticSnapshotPolicy. + /// The name of the ElasticSnapshotPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetElasticSnapshotPolicyAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + return await GetElasticSnapshotPolicies().GetAsync(snapshotPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// Get a ElasticSnapshotPolicy. + /// The name of the ElasticSnapshotPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetElasticSnapshotPolicy(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + return GetElasticSnapshotPolicies().Get(snapshotPolicyName, cancellationToken); + } + + /// Gets a collection of ElasticBackupVaults in the . + /// An object representing collection of ElasticBackupVaults and their operations over a ElasticBackupVaultResource. + public virtual ElasticBackupVaultCollection GetElasticBackupVaults() + { + return GetCachedClient(client => new ElasticBackupVaultCollection(client, Id)); + } + + /// Get the Elastic Backup Vault. + /// The name of the ElasticBackupVault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetElasticBackupVaultAsync(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + return await GetElasticBackupVaults().GetAsync(backupVaultName, cancellationToken).ConfigureAwait(false); + } + + /// Get the Elastic Backup Vault. + /// The name of the ElasticBackupVault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetElasticBackupVault(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + return GetElasticBackupVaults().Get(backupVaultName, cancellationToken); + } + + /// Gets a collection of ElasticBackupPolicies in the . + /// An object representing collection of ElasticBackupPolicies and their operations over a ElasticBackupPolicyResource. + public virtual ElasticBackupPolicyCollection GetElasticBackupPolicies() + { + return GetCachedClient(client => new ElasticBackupPolicyCollection(client, Id)); + } + + /// Get the Elastic Backup Policy. + /// The name of the ElasticBackupPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetElasticBackupPolicyAsync(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + return await GetElasticBackupPolicies().GetAsync(backupPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// Get the Elastic Backup Policy. + /// The name of the ElasticBackupPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetElasticBackupPolicy(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + return GetElasticBackupPolicies().Get(backupPolicyName, cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..a28398f26250 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetByResourceGroupAsyncCollectionResultOfT.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticAccountsGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly ElasticAccounts _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticAccountsGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticAccounts client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public ElasticAccountsGetByResourceGroupAsyncCollectionResultOfT(ElasticAccounts client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of ElasticAccountsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticAccountsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ElasticAccountListResult result = ElasticAccountListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticAccountCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetByResourceGroupCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..d75bc95c5c64 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetByResourceGroupCollectionResultOfT.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticAccountsGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly ElasticAccounts _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticAccountsGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticAccounts client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public ElasticAccountsGetByResourceGroupCollectionResultOfT(ElasticAccounts client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of ElasticAccountsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticAccountsGetByResourceGroupCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ElasticAccountListResult result = ElasticAccountListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticAccountCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..7a3f58a5d6c0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetBySubscriptionAsyncCollectionResultOfT.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticAccountsGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly ElasticAccounts _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticAccountsGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticAccounts client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ElasticAccountsGetBySubscriptionAsyncCollectionResultOfT(ElasticAccounts client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of ElasticAccountsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticAccountsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ElasticAccountListResult result = ElasticAccountListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetElasticAccounts"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetBySubscriptionCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..9899232d22e8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticAccountsGetBySubscriptionCollectionResultOfT.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticAccountsGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly ElasticAccounts _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticAccountsGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticAccounts client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ElasticAccountsGetBySubscriptionCollectionResultOfT(ElasticAccounts client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of ElasticAccountsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticAccountsGetBySubscriptionCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ElasticAccountListResult result = ElasticAccountListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetElasticAccounts"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupCollection.cs new file mode 100644 index 000000000000..d0bbdd6ce233 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupCollection.cs @@ -0,0 +1,559 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetElasticBackups method from an instance of the parent resource. + /// + public partial class ElasticBackupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _elasticBackupsClientDiagnostics; + private readonly ElasticBackups _elasticBackupsRestClient; + + /// Initializes a new instance of ElasticBackupCollection for mocking. + protected ElasticBackupCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticBackupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ElasticBackupResource.ResourceType, out string elasticBackupApiVersion); + _elasticBackupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ElasticBackupResource.ResourceType.Namespace, Diagnostics); + _elasticBackupsRestClient = new ElasticBackups(_elasticBackupsClientDiagnostics, Pipeline, Endpoint, elasticBackupApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ElasticBackupVaultResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ElasticBackupVaultResource.ResourceType), id); + } + } + + /// + /// Create an elastic backup under the elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticBackup. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string backupName, ElasticBackupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, ElasticBackupData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupOperationSource(Client), + _elasticBackupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create an elastic backup under the elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticBackup. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string backupName, ElasticBackupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, ElasticBackupData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupOperationSource(Client), + _elasticBackupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Elastic Backup under Elastic Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Elastic Backup under Elastic Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all elastic backups Under an elastic Backup Vault. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ElasticBackupsGetByVaultAsyncCollectionResultOfT( + _elasticBackupsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new ElasticBackupResource(Client, data)); + } + + /// List all elastic backups Under an elastic Backup Vault. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ElasticBackupsGetByVaultCollectionResultOfT( + _elasticBackupsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new ElasticBackupResource(Client, data)); + } + + /// + /// Get the specified Elastic Backup under Elastic Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Elastic Backup under Elastic Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Elastic Backup under Elastic Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Elastic Backup under Elastic Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupData.Serialization.cs new file mode 100644 index 000000000000..442199afd9a1 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupData.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp Elastic Backup under an elastic Backup Vault. + public partial class ElasticBackupData : ResourceData, IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticBackupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ElasticBackupData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticBackupData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticBackupData DeserializeElasticBackupData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + ElasticBackupProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticBackupProperties.DeserializeElasticBackupProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticBackupData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticBackupData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticBackupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ElasticBackupData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticBackupData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticBackupData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticBackupData elasticBackupData) + { + if (elasticBackupData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticBackupData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ElasticBackupData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticBackupData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupData.cs new file mode 100644 index 000000000000..3552fbc8b452 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupData.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp Elastic Backup under an elastic Backup Vault. + public partial class ElasticBackupData : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticBackupData() + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// The resource-specific properties for this resource. + internal ElasticBackupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, ElasticBackupProperties properties) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// The resource-specific properties for this resource. + public ElasticBackupProperties Properties { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPoliciesGetByElasticAccountAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPoliciesGetByElasticAccountAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..edd5b08a6ec3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPoliciesGetByElasticAccountAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticBackupPoliciesGetByElasticAccountAsyncCollectionResultOfT : AsyncPageable + { + private readonly ElasticBackupPolicies _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticBackupPoliciesGetByElasticAccountAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticBackupPolicies client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ElasticBackupPoliciesGetByElasticAccountAsyncCollectionResultOfT(ElasticBackupPolicies client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of ElasticBackupPoliciesGetByElasticAccountAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticBackupPoliciesGetByElasticAccountAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ElasticBackupPolicyListResult result = ElasticBackupPolicyListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByElasticAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByElasticAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticBackupPolicyCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPoliciesGetByElasticAccountCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPoliciesGetByElasticAccountCollectionResultOfT.cs new file mode 100644 index 000000000000..f1948b72225e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPoliciesGetByElasticAccountCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticBackupPoliciesGetByElasticAccountCollectionResultOfT : Pageable + { + private readonly ElasticBackupPolicies _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticBackupPoliciesGetByElasticAccountCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticBackupPolicies client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ElasticBackupPoliciesGetByElasticAccountCollectionResultOfT(ElasticBackupPolicies client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of ElasticBackupPoliciesGetByElasticAccountCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticBackupPoliciesGetByElasticAccountCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ElasticBackupPolicyListResult result = ElasticBackupPolicyListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByElasticAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByElasticAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticBackupPolicyCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyCollection.cs new file mode 100644 index 000000000000..325452b65fb8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyCollection.cs @@ -0,0 +1,547 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetElasticBackupPolicies method from an instance of the parent resource. + /// + public partial class ElasticBackupPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _elasticBackupPoliciesClientDiagnostics; + private readonly ElasticBackupPolicies _elasticBackupPoliciesRestClient; + + /// Initializes a new instance of ElasticBackupPolicyCollection for mocking. + protected ElasticBackupPolicyCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticBackupPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ElasticBackupPolicyResource.ResourceType, out string elasticBackupPolicyApiVersion); + _elasticBackupPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ElasticBackupPolicyResource.ResourceType.Namespace, Diagnostics); + _elasticBackupPoliciesRestClient = new ElasticBackupPolicies(_elasticBackupPoliciesClientDiagnostics, Pipeline, Endpoint, elasticBackupPolicyApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ElasticAccountResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ElasticAccountResource.ResourceType), id); + } + } + + /// + /// Create or update the specified Elastic Backup Policy in the NetApp account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticBackupPolicy. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string backupPolicyName, ElasticBackupPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, ElasticBackupPolicyData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupPolicyOperationSource(Client), + _elasticBackupPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the specified Elastic Backup Policy in the NetApp account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticBackupPolicy. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string backupPolicyName, ElasticBackupPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, ElasticBackupPolicyData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupPolicyOperationSource(Client), + _elasticBackupPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List and describe all Elastic Backup Policies in the elastic account. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ElasticBackupPoliciesGetByElasticAccountAsyncCollectionResultOfT(_elasticBackupPoliciesRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new ElasticBackupPolicyResource(Client, data)); + } + + /// List and describe all Elastic Backup Policies in the elastic account. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ElasticBackupPoliciesGetByElasticAccountCollectionResultOfT(_elasticBackupPoliciesRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new ElasticBackupPolicyResource(Client, data)); + } + + /// + /// Get the Elastic Backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupPolicyName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyData.Serialization.cs new file mode 100644 index 000000000000..8d3d20ac18fb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyData.Serialization.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp elastic backup vault resource. + public partial class ElasticBackupPolicyData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticBackupPolicyData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupPolicyData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticBackupPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ElasticBackupPolicyData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupPolicyData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticBackupPolicyData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticBackupPolicyData DeserializeElasticBackupPolicyData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + ElasticBackupPolicyProperties properties = default; + string eTag = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticBackupPolicyProperties.DeserializeElasticBackupPolicyProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("eTag"u8)) + { + eTag = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticBackupPolicyData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + eTag); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticBackupPolicyData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticBackupPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ElasticBackupPolicyData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticBackupPolicyData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticBackupPolicyData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticBackupPolicyData elasticBackupPolicyData) + { + if (elasticBackupPolicyData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticBackupPolicyData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ElasticBackupPolicyData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticBackupPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyData.cs new file mode 100644 index 000000000000..c3c76325642d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp elastic backup vault resource. + public partial class ElasticBackupPolicyData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public ElasticBackupPolicyData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + internal ElasticBackupPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, ElasticBackupPolicyProperties properties, string eTag) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; + } + + /// The resource-specific properties for this resource. + public ElasticBackupPolicyProperties Properties { get; set; } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + public string ETag { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyResource.Serialization.cs new file mode 100644 index 000000000000..8737e6f9c26a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class ElasticBackupPolicyResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ElasticBackupPolicyData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ElasticBackupPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + ElasticBackupPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyResource.cs new file mode 100644 index 000000000000..8a5793bdc832 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupPolicyResource.cs @@ -0,0 +1,682 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a ElasticBackupPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetElasticBackupPolicies method. + /// + public partial class ElasticBackupPolicyResource : ArmResource + { + private readonly ClientDiagnostics _elasticBackupPoliciesClientDiagnostics; + private readonly ElasticBackupPolicies _elasticBackupPoliciesRestClient; + private readonly ElasticBackupPolicyData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/elasticAccounts/elasticBackupPolicies"; + + /// Initializes a new instance of ElasticBackupPolicyResource for mocking. + protected ElasticBackupPolicyResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ElasticBackupPolicyResource(ArmClient client, ElasticBackupPolicyData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticBackupPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string elasticBackupPolicyApiVersion); + _elasticBackupPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _elasticBackupPoliciesRestClient = new ElasticBackupPolicies(_elasticBackupPoliciesClientDiagnostics, Pipeline, Endpoint, elasticBackupPolicyApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual ElasticBackupPolicyData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The backupPolicyName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the Elastic Backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified NetApp Elastic Backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticBackupPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ElasticBackupPolicyData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupPolicyOperationSource(Client), + _elasticBackupPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified NetApp Elastic Backup Policy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticBackupPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ElasticBackupPolicyData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupPolicyOperationSource(Client), + _elasticBackupPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified Elastic Policy Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_elasticBackupPoliciesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified Elastic Policy Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupPolicies/{backupPolicyName}. + /// + /// + /// Operation Id. + /// ElasticBackupPolicies_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_elasticBackupPoliciesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticBackupPolicyData patch = new ElasticBackupPolicyData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticBackupPolicyData patch = new ElasticBackupPolicyData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticBackupPolicyData patch = new ElasticBackupPolicyData(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticBackupPolicyData patch = new ElasticBackupPolicyData(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticBackupPolicyData patch = new ElasticBackupPolicyData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticBackupPoliciesClientDiagnostics.CreateScope("ElasticBackupPolicyResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticBackupPolicyData patch = new ElasticBackupPolicyData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupResource.Serialization.cs new file mode 100644 index 000000000000..59bbdb60500a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class ElasticBackupResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ElasticBackupData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ElasticBackupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + ElasticBackupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupResource.cs new file mode 100644 index 000000000000..179e2b87a5b8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupResource.cs @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a ElasticBackup along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetElasticBackups method. + /// + public partial class ElasticBackupResource : ArmResource + { + private readonly ClientDiagnostics _elasticBackupsClientDiagnostics; + private readonly ElasticBackups _elasticBackupsRestClient; + private readonly ElasticBackupData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/elasticAccounts/elasticBackupVaults/backups"; + + /// Initializes a new instance of ElasticBackupResource for mocking. + protected ElasticBackupResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ElasticBackupResource(ArmClient client, ElasticBackupData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticBackupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string elasticBackupApiVersion); + _elasticBackupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _elasticBackupsRestClient = new ElasticBackups(_elasticBackupsClientDiagnostics, Pipeline, Endpoint, elasticBackupApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual ElasticBackupData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The backupVaultName. + /// The backupName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the specified Elastic Backup under Elastic Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the specified Elastic Backup under Elastic Backup Vault. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch an elastic Backup under the Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticBackupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ElasticBackupData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupOperationSource(Client), + _elasticBackupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch an elastic Backup under the Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticBackupData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ElasticBackupData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupOperationSource(Client), + _elasticBackupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a ElasticBackup + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_elasticBackupsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a ElasticBackup + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}/backups/{backupName}. + /// + /// + /// Operation Id. + /// ElasticBackups_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupsClientDiagnostics.CreateScope("ElasticBackupResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_elasticBackupsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultCollection.cs new file mode 100644 index 000000000000..f0c348431ddd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultCollection.cs @@ -0,0 +1,547 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetElasticBackupVaults method from an instance of the parent resource. + /// + public partial class ElasticBackupVaultCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _elasticBackupVaultsClientDiagnostics; + private readonly ElasticBackupVaults _elasticBackupVaultsRestClient; + + /// Initializes a new instance of ElasticBackupVaultCollection for mocking. + protected ElasticBackupVaultCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticBackupVaultCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ElasticBackupVaultResource.ResourceType, out string elasticBackupVaultApiVersion); + _elasticBackupVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ElasticBackupVaultResource.ResourceType.Namespace, Diagnostics); + _elasticBackupVaultsRestClient = new ElasticBackupVaults(_elasticBackupVaultsClientDiagnostics, Pipeline, Endpoint, elasticBackupVaultApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ElasticAccountResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ElasticAccountResource.ResourceType), id); + } + } + + /// + /// Create or update the specified Elastic Backup Vault in the NetApp account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticBackupVault. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string backupVaultName, ElasticBackupVaultData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, ElasticBackupVaultData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupVaultOperationSource(Client), + _elasticBackupVaultsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the specified Elastic Backup Vault in the NetApp account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticBackupVault. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string backupVaultName, ElasticBackupVaultData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, ElasticBackupVaultData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupVaultOperationSource(Client), + _elasticBackupVaultsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupVault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupVault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List and describe all Elastic Backup Vaults in the elastic account. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ElasticBackupVaultsGetByElasticAccountAsyncCollectionResultOfT(_elasticBackupVaultsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new ElasticBackupVaultResource(Client, data)); + } + + /// List and describe all Elastic Backup Vaults in the elastic account. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ElasticBackupVaultsGetByElasticAccountCollectionResultOfT(_elasticBackupVaultsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new ElasticBackupVaultResource(Client, data)); + } + + /// + /// Get the Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupVault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupVault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupVault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticBackupVault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, backupVaultName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticBackupVaultData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultData.Serialization.cs new file mode 100644 index 000000000000..f327047650ac --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultData.Serialization.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp elastic backup vault resource. + public partial class ElasticBackupVaultData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticBackupVaultData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupVaultData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticBackupVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ElasticBackupVaultData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupVaultData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticBackupVaultData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticBackupVaultData DeserializeElasticBackupVaultData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + ElasticBackupVaultProperties properties = default; + string eTag = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticBackupVaultProperties.DeserializeElasticBackupVaultProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("eTag"u8)) + { + eTag = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticBackupVaultData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + eTag); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticBackupVaultData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticBackupVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ElasticBackupVaultData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticBackupVaultData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticBackupVaultData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticBackupVaultData elasticBackupVaultData) + { + if (elasticBackupVaultData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticBackupVaultData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ElasticBackupVaultData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticBackupVaultData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultData.cs new file mode 100644 index 000000000000..98dc2fee647a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultData.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp elastic backup vault resource. + public partial class ElasticBackupVaultData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public ElasticBackupVaultData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + internal ElasticBackupVaultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, ElasticBackupVaultProperties properties, string eTag) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; + } + + /// The resource-specific properties for this resource. + internal ElasticBackupVaultProperties Properties { get; set; } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + public string ETag { get; } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ElasticBackupVaultProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultResource.Serialization.cs new file mode 100644 index 000000000000..50830293c16c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class ElasticBackupVaultResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ElasticBackupVaultData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ElasticBackupVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + ElasticBackupVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultResource.cs new file mode 100644 index 000000000000..7bceca09d2d6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultResource.cs @@ -0,0 +1,715 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a ElasticBackupVault along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetElasticBackupVaults method. + /// + public partial class ElasticBackupVaultResource : ArmResource + { + private readonly ClientDiagnostics _elasticBackupVaultsClientDiagnostics; + private readonly ElasticBackupVaults _elasticBackupVaultsRestClient; + private readonly ElasticBackupVaultData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/elasticAccounts/elasticBackupVaults"; + + /// Initializes a new instance of ElasticBackupVaultResource for mocking. + protected ElasticBackupVaultResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ElasticBackupVaultResource(ArmClient client, ElasticBackupVaultData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticBackupVaultResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string elasticBackupVaultApiVersion); + _elasticBackupVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _elasticBackupVaultsRestClient = new ElasticBackupVaults(_elasticBackupVaultsClientDiagnostics, Pipeline, Endpoint, elasticBackupVaultApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual ElasticBackupVaultData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The backupVaultName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified NetApp Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticBackupVaultData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ElasticBackupVaultData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupVaultOperationSource(Client), + _elasticBackupVaultsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified NetApp Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticBackupVaultData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ElasticBackupVaultData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticBackupVaultOperationSource(Client), + _elasticBackupVaultsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_elasticBackupVaultsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified Elastic Backup Vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticBackupVaults/{backupVaultName}. + /// + /// + /// Operation Id. + /// ElasticBackupVaults_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_elasticBackupVaultsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupVaultData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticBackupVaultData patch = new ElasticBackupVaultData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupVaultData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticBackupVaultData patch = new ElasticBackupVaultData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupVaultData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticBackupVaultData patch = new ElasticBackupVaultData(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupVaultData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticBackupVaultData patch = new ElasticBackupVaultData(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupVaultData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticBackupVaultData patch = new ElasticBackupVaultData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticBackupVaultsClientDiagnostics.CreateScope("ElasticBackupVaultResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticBackupVaultsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticBackupVaultData.FromResponse(result), result); + return Response.FromValue(new ElasticBackupVaultResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticBackupVaultData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticBackupVaultData patch = new ElasticBackupVaultData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a collection of ElasticBackups in the . + /// An object representing collection of ElasticBackups and their operations over a ElasticBackupResource. + public virtual ElasticBackupCollection GetElasticBackups() + { + return GetCachedClient(client => new ElasticBackupCollection(client, Id)); + } + + /// Get the specified Elastic Backup under Elastic Backup Vault. + /// The name of the ElasticBackup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetElasticBackupAsync(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + return await GetElasticBackups().GetAsync(backupName, cancellationToken).ConfigureAwait(false); + } + + /// Get the specified Elastic Backup under Elastic Backup Vault. + /// The name of the ElasticBackup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetElasticBackup(string backupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); + + return GetElasticBackups().Get(backupName, cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultsGetByElasticAccountAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultsGetByElasticAccountAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..d09381ed6ac7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultsGetByElasticAccountAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticBackupVaultsGetByElasticAccountAsyncCollectionResultOfT : AsyncPageable + { + private readonly ElasticBackupVaults _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticBackupVaultsGetByElasticAccountAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticBackupVaults client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ElasticBackupVaultsGetByElasticAccountAsyncCollectionResultOfT(ElasticBackupVaults client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of ElasticBackupVaultsGetByElasticAccountAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticBackupVaultsGetByElasticAccountAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ElasticBackupVaultListResult result = ElasticBackupVaultListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByElasticAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByElasticAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticBackupVaultCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultsGetByElasticAccountCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultsGetByElasticAccountCollectionResultOfT.cs new file mode 100644 index 000000000000..e679458eab84 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupVaultsGetByElasticAccountCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticBackupVaultsGetByElasticAccountCollectionResultOfT : Pageable + { + private readonly ElasticBackupVaults _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticBackupVaultsGetByElasticAccountCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticBackupVaults client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ElasticBackupVaultsGetByElasticAccountCollectionResultOfT(ElasticBackupVaults client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of ElasticBackupVaultsGetByElasticAccountCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticBackupVaultsGetByElasticAccountCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ElasticBackupVaultListResult result = ElasticBackupVaultListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByElasticAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByElasticAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticBackupVaultCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupsGetByVaultAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupsGetByVaultAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..0c6bb676c6b9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupsGetByVaultAsyncCollectionResultOfT.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticBackupsGetByVaultAsyncCollectionResultOfT : AsyncPageable + { + private readonly ElasticBackups _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _backupVaultName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticBackupsGetByVaultAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticBackups client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The name of the ElasticBackupVault. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public ElasticBackupsGetByVaultAsyncCollectionResultOfT(ElasticBackups client, Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _backupVaultName = backupVaultName; + _context = context; + } + + /// Gets the pages of ElasticBackupsGetByVaultAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticBackupsGetByVaultAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ElasticBackupListResult result = ElasticBackupListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByVaultRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _backupVaultName, _context) : _client.CreateGetByVaultRequest(_subscriptionId, _resourceGroupName, _accountName, _backupVaultName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticBackupCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupsGetByVaultCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupsGetByVaultCollectionResultOfT.cs new file mode 100644 index 000000000000..4572dd91d26f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticBackupsGetByVaultCollectionResultOfT.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticBackupsGetByVaultCollectionResultOfT : Pageable + { + private readonly ElasticBackups _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _backupVaultName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticBackupsGetByVaultCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticBackups client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The name of the ElasticBackupVault. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public ElasticBackupsGetByVaultCollectionResultOfT(ElasticBackups client, Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _backupVaultName = backupVaultName; + _context = context; + } + + /// Gets the pages of ElasticBackupsGetByVaultCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticBackupsGetByVaultCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ElasticBackupListResult result = ElasticBackupListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByVaultRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _backupVaultName, _context) : _client.CreateGetByVaultRequest(_subscriptionId, _resourceGroupName, _accountName, _backupVaultName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticBackupCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolCollection.cs new file mode 100644 index 000000000000..5713712a064d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolCollection.cs @@ -0,0 +1,547 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetElasticCapacityPools method from an instance of the parent resource. + /// + public partial class ElasticCapacityPoolCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _elasticCapacityPoolsClientDiagnostics; + private readonly ElasticCapacityPools _elasticCapacityPoolsRestClient; + + /// Initializes a new instance of ElasticCapacityPoolCollection for mocking. + protected ElasticCapacityPoolCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticCapacityPoolCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ElasticCapacityPoolResource.ResourceType, out string elasticCapacityPoolApiVersion); + _elasticCapacityPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ElasticCapacityPoolResource.ResourceType.Namespace, Diagnostics); + _elasticCapacityPoolsRestClient = new ElasticCapacityPools(_elasticCapacityPoolsClientDiagnostics, Pipeline, Endpoint, elasticCapacityPoolApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ElasticAccountResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ElasticAccountResource.ResourceType), id); + } + } + + /// + /// Create or update the specified NetApp elastic account within the resource group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticCapacityPool. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string poolName, ElasticCapacityPoolData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, ElasticCapacityPoolData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticCapacityPoolOperationSource(Client), + _elasticCapacityPoolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the specified NetApp elastic account within the resource group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticCapacityPool. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string poolName, ElasticCapacityPoolData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, ElasticCapacityPoolData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticCapacityPoolOperationSource(Client), + _elasticCapacityPoolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticCapacityPool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticCapacityPool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List and describe all NetApp elastic accounts in the Elastic NetAppAccount. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ElasticCapacityPoolsGetByNetAppAccountAsyncCollectionResultOfT(_elasticCapacityPoolsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new ElasticCapacityPoolResource(Client, data)); + } + + /// List and describe all NetApp elastic accounts in the Elastic NetAppAccount. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ElasticCapacityPoolsGetByNetAppAccountCollectionResultOfT(_elasticCapacityPoolsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new ElasticCapacityPoolResource(Client, data)); + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticCapacityPool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticCapacityPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticCapacityPool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticCapacityPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticCapacityPool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticCapacityPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticCapacityPool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, poolName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticCapacityPoolData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolData.Serialization.cs new file mode 100644 index 000000000000..a16da54f30c9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolData.Serialization.cs @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp elastic capacity pool resource. + public partial class ElasticCapacityPoolData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticCapacityPoolData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticCapacityPoolData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (string item in Zones) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticCapacityPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ElasticCapacityPoolData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticCapacityPoolData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticCapacityPoolData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticCapacityPoolData DeserializeElasticCapacityPoolData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + ElasticCapacityPoolProperties properties = default; + string eTag = default; + IList zones = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticCapacityPoolProperties.DeserializeElasticCapacityPoolProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("eTag"u8)) + { + eTag = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("zones"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + zones = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticCapacityPoolData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + eTag, + zones ?? new ChangeTrackingList()); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticCapacityPoolData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticCapacityPoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ElasticCapacityPoolData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticCapacityPoolData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticCapacityPoolData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticCapacityPoolData elasticCapacityPoolData) + { + if (elasticCapacityPoolData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticCapacityPoolData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ElasticCapacityPoolData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticCapacityPoolData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolData.cs new file mode 100644 index 000000000000..c9c8938e9d1a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolData.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp elastic capacity pool resource. + public partial class ElasticCapacityPoolData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public ElasticCapacityPoolData(AzureLocation location) : base(location) + { + Zones = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The availability zones. + internal ElasticCapacityPoolData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, ElasticCapacityPoolProperties properties, string eTag, IList zones) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; + Zones = zones; + } + + /// The resource-specific properties for this resource. + public ElasticCapacityPoolProperties Properties { get; set; } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + public string ETag { get; } + + /// The availability zones. + public IList Zones { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolResource.Serialization.cs new file mode 100644 index 000000000000..8f3a3f923e8e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class ElasticCapacityPoolResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ElasticCapacityPoolData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ElasticCapacityPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + ElasticCapacityPoolData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolResource.cs new file mode 100644 index 000000000000..12c1ba8c0160 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolResource.cs @@ -0,0 +1,938 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a ElasticCapacityPool along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetElasticCapacityPools method. + /// + public partial class ElasticCapacityPoolResource : ArmResource + { + private readonly ClientDiagnostics _elasticCapacityPoolsClientDiagnostics; + private readonly ElasticCapacityPools _elasticCapacityPoolsRestClient; + private readonly ElasticCapacityPoolData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/elasticAccounts/elasticCapacityPools"; + + /// Initializes a new instance of ElasticCapacityPoolResource for mocking. + protected ElasticCapacityPoolResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ElasticCapacityPoolResource(ArmClient client, ElasticCapacityPoolData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticCapacityPoolResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string elasticCapacityPoolApiVersion); + _elasticCapacityPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _elasticCapacityPoolsRestClient = new ElasticCapacityPools(_elasticCapacityPoolsClientDiagnostics, Pipeline, Endpoint, elasticCapacityPoolApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual ElasticCapacityPoolData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticCapacityPoolPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ElasticCapacityPoolPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticCapacityPoolOperationSource(Client), + _elasticCapacityPoolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticCapacityPoolPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ElasticCapacityPoolPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticCapacityPoolOperationSource(Client), + _elasticCapacityPoolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_elasticCapacityPoolsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_elasticCapacityPoolsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Moves pool to another zone + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/changeZone. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_ChangeZone. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task> ChangeZoneAsync(WaitUntil waitUntil, ChangeZoneRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.ChangeZone"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateChangeZoneRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ChangeZoneRequest.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticCapacityPoolOperationSource(Client), + _elasticCapacityPoolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Moves pool to another zone + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/changeZone. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_ChangeZone. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation ChangeZone(WaitUntil waitUntil, ChangeZoneRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.ChangeZone"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateChangeZoneRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ChangeZoneRequest.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticCapacityPoolOperationSource(Client), + _elasticCapacityPoolsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if a volume file path is available within the given elastic capacityPool. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/checkVolumeFilePathAvailability. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_CheckVolumeFilePathAvailability. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckVolumeFilePathAvailabilityAsync(CheckElasticVolumeFilePathAvailabilityRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.CheckVolumeFilePathAvailability"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateCheckVolumeFilePathAvailabilityRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, CheckElasticVolumeFilePathAvailabilityRequest.ToRequestContent(content), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CheckElasticResourceAvailabilityResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Check if a volume file path is available within the given elastic capacityPool. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/checkVolumeFilePathAvailability. + /// + /// + /// Operation Id. + /// ElasticCapacityPools_CheckVolumeFilePathAvailability. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckVolumeFilePathAvailability(CheckElasticVolumeFilePathAvailabilityRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.CheckVolumeFilePathAvailability"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateCheckVolumeFilePathAvailabilityRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, CheckElasticVolumeFilePathAvailabilityRequest.ToRequestContent(content), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CheckElasticResourceAvailabilityResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticCapacityPoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticCapacityPoolPatch patch = new ElasticCapacityPoolPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticCapacityPoolData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticCapacityPoolPatch patch = new ElasticCapacityPoolPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticCapacityPoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticCapacityPoolPatch patch = new ElasticCapacityPoolPatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticCapacityPoolData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticCapacityPoolPatch patch = new ElasticCapacityPoolPatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticCapacityPoolData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticCapacityPoolPatch patch = new ElasticCapacityPoolPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticCapacityPoolsClientDiagnostics.CreateScope("ElasticCapacityPoolResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticCapacityPoolsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticCapacityPoolData.FromResponse(result), result); + return Response.FromValue(new ElasticCapacityPoolResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticCapacityPoolData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticCapacityPoolPatch patch = new ElasticCapacityPoolPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a collection of ElasticVolumes in the . + /// An object representing collection of ElasticVolumes and their operations over a ElasticVolumeResource. + public virtual ElasticVolumeCollection GetElasticVolumes() + { + return GetCachedClient(client => new ElasticVolumeCollection(client, Id)); + } + + /// Get the details of the specified volume. + /// The name of the ElasticVolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetElasticVolumeAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + return await GetElasticVolumes().GetAsync(volumeName, cancellationToken).ConfigureAwait(false); + } + + /// Get the details of the specified volume. + /// The name of the ElasticVolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetElasticVolume(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + return GetElasticVolumes().Get(volumeName, cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolsGetByNetAppAccountAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolsGetByNetAppAccountAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..1088b27c5203 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolsGetByNetAppAccountAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticCapacityPoolsGetByNetAppAccountAsyncCollectionResultOfT : AsyncPageable + { + private readonly ElasticCapacityPools _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticCapacityPoolsGetByNetAppAccountAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticCapacityPools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ElasticCapacityPoolsGetByNetAppAccountAsyncCollectionResultOfT(ElasticCapacityPools client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of ElasticCapacityPoolsGetByNetAppAccountAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticCapacityPoolsGetByNetAppAccountAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ElasticCapacityPoolListResult result = ElasticCapacityPoolListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByNetAppAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByNetAppAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticCapacityPoolCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolsGetByNetAppAccountCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolsGetByNetAppAccountCollectionResultOfT.cs new file mode 100644 index 000000000000..f47435bd625d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticCapacityPoolsGetByNetAppAccountCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticCapacityPoolsGetByNetAppAccountCollectionResultOfT : Pageable + { + private readonly ElasticCapacityPools _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticCapacityPoolsGetByNetAppAccountCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticCapacityPools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ElasticCapacityPoolsGetByNetAppAccountCollectionResultOfT(ElasticCapacityPools client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of ElasticCapacityPoolsGetByNetAppAccountCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticCapacityPoolsGetByNetAppAccountCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ElasticCapacityPoolListResult result = ElasticCapacityPoolListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByNetAppAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByNetAppAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticCapacityPoolCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotCollection.cs new file mode 100644 index 000000000000..079b08f270cd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotCollection.cs @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetElasticSnapshots method from an instance of the parent resource. + /// + public partial class ElasticSnapshotCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _elasticSnapshotsClientDiagnostics; + private readonly ElasticSnapshots _elasticSnapshotsRestClient; + + /// Initializes a new instance of ElasticSnapshotCollection for mocking. + protected ElasticSnapshotCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticSnapshotCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ElasticSnapshotResource.ResourceType, out string elasticSnapshotApiVersion); + _elasticSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ElasticSnapshotResource.ResourceType.Namespace, Diagnostics); + _elasticSnapshotsRestClient = new ElasticSnapshots(_elasticSnapshotsClientDiagnostics, Pipeline, Endpoint, elasticSnapshotApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ElasticVolumeResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ElasticVolumeResource.ResourceType), id); + } + } + + /// + /// Create a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticSnapshot. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string snapshotName, ElasticSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, ElasticSnapshotData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticSnapshotOperationSource(Client), + _elasticSnapshotsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticSnapshot. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string snapshotName, ElasticSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, ElasticSnapshotData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticSnapshotOperationSource(Client), + _elasticSnapshotsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticSnapshotData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticSnapshotData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List ElasticSnapshot resources by ElasticVolume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ElasticSnapshotsGetByElasticVolumeAsyncCollectionResultOfT( + _elasticSnapshotsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new ElasticSnapshotResource(Client, data)); + } + + /// List ElasticSnapshot resources by ElasticVolume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ElasticSnapshotsGetByElasticVolumeCollectionResultOfT( + _elasticSnapshotsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new ElasticSnapshotResource(Client, data)); + } + + /// + /// Get a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticSnapshotData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticSnapshotData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticSnapshotData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticSnapshotData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticSnapshotData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticSnapshotData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticSnapshotData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticSnapshotData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotData.Serialization.cs new file mode 100644 index 000000000000..7b18ab329f79 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotData.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp Elastic Snapshot under an elastic volume. + public partial class ElasticSnapshotData : ResourceData, IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ElasticSnapshotData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotData DeserializeElasticSnapshotData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + ElasticSnapshotProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticSnapshotProperties.DeserializeElasticSnapshotProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ElasticSnapshotData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticSnapshotData elasticSnapshotData) + { + if (elasticSnapshotData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticSnapshotData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ElasticSnapshotData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticSnapshotData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotData.cs new file mode 100644 index 000000000000..11b4549036d9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotData.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp Elastic Snapshot under an elastic volume. + public partial class ElasticSnapshotData : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticSnapshotData() + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// The resource-specific properties for this resource. + internal ElasticSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, ElasticSnapshotProperties properties) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// The resource-specific properties for this resource. + internal ElasticSnapshotProperties Properties { get; set; } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ElasticSnapshotProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetByElasticAccountAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetByElasticAccountAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..9f8d75e47fc4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetByElasticAccountAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticSnapshotPoliciesGetByElasticAccountAsyncCollectionResultOfT : AsyncPageable + { + private readonly ElasticSnapshotPolicies _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticSnapshotPoliciesGetByElasticAccountAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticSnapshotPolicies client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ElasticSnapshotPoliciesGetByElasticAccountAsyncCollectionResultOfT(ElasticSnapshotPolicies client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of ElasticSnapshotPoliciesGetByElasticAccountAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticSnapshotPoliciesGetByElasticAccountAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ElasticSnapshotPolicyListResult result = ElasticSnapshotPolicyListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByElasticAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByElasticAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticSnapshotPolicyCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetByElasticAccountCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetByElasticAccountCollectionResultOfT.cs new file mode 100644 index 000000000000..c6c9e35e03eb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetByElasticAccountCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticSnapshotPoliciesGetByElasticAccountCollectionResultOfT : Pageable + { + private readonly ElasticSnapshotPolicies _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticSnapshotPoliciesGetByElasticAccountCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticSnapshotPolicies client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ElasticSnapshotPoliciesGetByElasticAccountCollectionResultOfT(ElasticSnapshotPolicies client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of ElasticSnapshotPoliciesGetByElasticAccountCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticSnapshotPoliciesGetByElasticAccountCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ElasticSnapshotPolicyListResult result = ElasticSnapshotPolicyListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByElasticAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByElasticAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticSnapshotPolicyCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetVolumesAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetVolumesAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..c6dd2d257200 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetVolumesAsyncCollectionResultOfT.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticSnapshotPoliciesGetVolumesAsyncCollectionResultOfT : AsyncPageable + { + private readonly ElasticSnapshotPolicies _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _snapshotPolicyName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticSnapshotPoliciesGetVolumesAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticSnapshotPolicies client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The name of the ElasticSnapshotPolicy. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public ElasticSnapshotPoliciesGetVolumesAsyncCollectionResultOfT(ElasticSnapshotPolicies client, Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _snapshotPolicyName = snapshotPolicyName; + _context = context; + } + + /// Gets the pages of ElasticSnapshotPoliciesGetVolumesAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticSnapshotPoliciesGetVolumesAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ElasticSnapshotPolicyVolumeList result = ElasticSnapshotPolicyVolumeList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetVolumesRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _snapshotPolicyName, _context) : _client.CreateGetVolumesRequest(_subscriptionId, _resourceGroupName, _accountName, _snapshotPolicyName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.GetVolumes"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetVolumesCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetVolumesCollectionResultOfT.cs new file mode 100644 index 000000000000..d7774b4cb6b8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPoliciesGetVolumesCollectionResultOfT.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticSnapshotPoliciesGetVolumesCollectionResultOfT : Pageable + { + private readonly ElasticSnapshotPolicies _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _snapshotPolicyName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticSnapshotPoliciesGetVolumesCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticSnapshotPolicies client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The name of the ElasticSnapshotPolicy. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public ElasticSnapshotPoliciesGetVolumesCollectionResultOfT(ElasticSnapshotPolicies client, Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _snapshotPolicyName = snapshotPolicyName; + _context = context; + } + + /// Gets the pages of ElasticSnapshotPoliciesGetVolumesCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticSnapshotPoliciesGetVolumesCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ElasticSnapshotPolicyVolumeList result = ElasticSnapshotPolicyVolumeList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetVolumesRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _snapshotPolicyName, _context) : _client.CreateGetVolumesRequest(_subscriptionId, _resourceGroupName, _accountName, _snapshotPolicyName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.GetVolumes"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyCollection.cs new file mode 100644 index 000000000000..d586eab4d7a5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyCollection.cs @@ -0,0 +1,547 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetElasticSnapshotPolicies method from an instance of the parent resource. + /// + public partial class ElasticSnapshotPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _elasticSnapshotPoliciesClientDiagnostics; + private readonly ElasticSnapshotPolicies _elasticSnapshotPoliciesRestClient; + + /// Initializes a new instance of ElasticSnapshotPolicyCollection for mocking. + protected ElasticSnapshotPolicyCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticSnapshotPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ElasticSnapshotPolicyResource.ResourceType, out string elasticSnapshotPolicyApiVersion); + _elasticSnapshotPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ElasticSnapshotPolicyResource.ResourceType.Namespace, Diagnostics); + _elasticSnapshotPoliciesRestClient = new ElasticSnapshotPolicies(_elasticSnapshotPoliciesClientDiagnostics, Pipeline, Endpoint, elasticSnapshotPolicyApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ElasticAccountResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ElasticAccountResource.ResourceType), id); + } + } + + /// + /// Create a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticSnapshotPolicy. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string snapshotPolicyName, ElasticSnapshotPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, ElasticSnapshotPolicyData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticSnapshotPolicyOperationSource(Client), + _elasticSnapshotPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticSnapshotPolicy. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string snapshotPolicyName, ElasticSnapshotPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, ElasticSnapshotPolicyData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticSnapshotPolicyOperationSource(Client), + _elasticSnapshotPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshotPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshotPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List ElasticSnapshotPolicy resources by ElasticAccount. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ElasticSnapshotPoliciesGetByElasticAccountAsyncCollectionResultOfT(_elasticSnapshotPoliciesRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new ElasticSnapshotPolicyResource(Client, data)); + } + + /// List ElasticSnapshotPolicy resources by ElasticAccount. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ElasticSnapshotPoliciesGetByElasticAccountCollectionResultOfT(_elasticSnapshotPoliciesRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new ElasticSnapshotPolicyResource(Client, data)); + } + + /// + /// Get a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshotPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticSnapshotPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshotPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticSnapshotPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshotPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticSnapshotPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticSnapshotPolicy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticSnapshotPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyData.Serialization.cs new file mode 100644 index 000000000000..35c1ca36a184 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyData.Serialization.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp Elastic Snapshot policy under an elastic account. + public partial class ElasticSnapshotPolicyData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticSnapshotPolicyData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ElasticSnapshotPolicyData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotPolicyData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotPolicyData DeserializeElasticSnapshotPolicyData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + ElasticSnapshotPolicyProperties properties = default; + string eTag = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticSnapshotPolicyProperties.DeserializeElasticSnapshotPolicyProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("eTag"u8)) + { + eTag = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotPolicyData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + eTag); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ElasticSnapshotPolicyData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotPolicyData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticSnapshotPolicyData elasticSnapshotPolicyData) + { + if (elasticSnapshotPolicyData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticSnapshotPolicyData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ElasticSnapshotPolicyData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticSnapshotPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyData.cs new file mode 100644 index 000000000000..9b9d6e9da2b2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp Elastic Snapshot policy under an elastic account. + public partial class ElasticSnapshotPolicyData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public ElasticSnapshotPolicyData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + internal ElasticSnapshotPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, ElasticSnapshotPolicyProperties properties, string eTag) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; + } + + /// The resource-specific properties for this resource. + public ElasticSnapshotPolicyProperties Properties { get; set; } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + public string ETag { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyResource.Serialization.cs new file mode 100644 index 000000000000..78690ba023db --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class ElasticSnapshotPolicyResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ElasticSnapshotPolicyData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ElasticSnapshotPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + ElasticSnapshotPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyResource.cs new file mode 100644 index 000000000000..2a1c3a52e0c7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotPolicyResource.cs @@ -0,0 +1,718 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a ElasticSnapshotPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetElasticSnapshotPolicies method. + /// + public partial class ElasticSnapshotPolicyResource : ArmResource + { + private readonly ClientDiagnostics _elasticSnapshotPoliciesClientDiagnostics; + private readonly ElasticSnapshotPolicies _elasticSnapshotPoliciesRestClient; + private readonly ElasticSnapshotPolicyData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/elasticAccounts/elasticSnapshotPolicies"; + + /// Initializes a new instance of ElasticSnapshotPolicyResource for mocking. + protected ElasticSnapshotPolicyResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ElasticSnapshotPolicyResource(ArmClient client, ElasticSnapshotPolicyData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticSnapshotPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string elasticSnapshotPolicyApiVersion); + _elasticSnapshotPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _elasticSnapshotPoliciesRestClient = new ElasticSnapshotPolicies(_elasticSnapshotPoliciesClientDiagnostics, Pipeline, Endpoint, elasticSnapshotPolicyApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual ElasticSnapshotPolicyData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The snapshotPolicyName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticSnapshotPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ElasticSnapshotPolicyData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticSnapshotPolicyOperationSource(Client), + _elasticSnapshotPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticSnapshotPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, ElasticSnapshotPolicyData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticSnapshotPolicyOperationSource(Client), + _elasticSnapshotPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_elasticSnapshotPoliciesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a ElasticSnapshotPolicy + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticSnapshotPolicies/{snapshotPolicyName}. + /// + /// + /// Operation Id. + /// ElasticSnapshotPolicies_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_elasticSnapshotPoliciesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get elastic volumes associated with elastic snapshot policy. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVolumesAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ElasticSnapshotPoliciesGetVolumesAsyncCollectionResultOfT( + _elasticSnapshotPoliciesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new ElasticVolumeResource(Client, data)); + } + + /// Get elastic volumes associated with elastic snapshot policy. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVolumes(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ElasticSnapshotPoliciesGetVolumesCollectionResultOfT( + _elasticSnapshotPoliciesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new ElasticVolumeResource(Client, data)); + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticSnapshotPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticSnapshotPolicyData patch = new ElasticSnapshotPolicyData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticSnapshotPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticSnapshotPolicyData patch = new ElasticSnapshotPolicyData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticSnapshotPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticSnapshotPolicyData patch = new ElasticSnapshotPolicyData(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticSnapshotPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticSnapshotPolicyData patch = new ElasticSnapshotPolicyData(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticSnapshotPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticSnapshotPolicyData patch = new ElasticSnapshotPolicyData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticSnapshotPoliciesClientDiagnostics.CreateScope("ElasticSnapshotPolicyResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticSnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new ElasticSnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticSnapshotPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticSnapshotPolicyData patch = new ElasticSnapshotPolicyData(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotResource.Serialization.cs new file mode 100644 index 000000000000..28c5f07bb66c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class ElasticSnapshotResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ElasticSnapshotData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ElasticSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + ElasticSnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotResource.cs new file mode 100644 index 000000000000..19710ffdd681 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotResource.cs @@ -0,0 +1,408 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a ElasticSnapshot along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetElasticSnapshots method. + /// + public partial class ElasticSnapshotResource : ArmResource + { + private readonly ClientDiagnostics _elasticSnapshotsClientDiagnostics; + private readonly ElasticSnapshots _elasticSnapshotsRestClient; + private readonly ElasticSnapshotData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/elasticAccounts/elasticCapacityPools/elasticVolumes/elasticSnapshots"; + + /// Initializes a new instance of ElasticSnapshotResource for mocking. + protected ElasticSnapshotResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ElasticSnapshotResource(ArmClient client, ElasticSnapshotData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticSnapshotResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string elasticSnapshotApiVersion); + _elasticSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _elasticSnapshotsRestClient = new ElasticSnapshots(_elasticSnapshotsClientDiagnostics, Pipeline, Endpoint, elasticSnapshotApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual ElasticSnapshotData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + /// The snapshotName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticSnapshotData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticSnapshotData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_elasticSnapshotsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_elasticSnapshotsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ElasticSnapshotData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticSnapshotOperationSource(Client), + _elasticSnapshotsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a ElasticSnapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/elasticSnapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// ElasticSnapshots_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticSnapshotsClientDiagnostics.CreateScope("ElasticSnapshotResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticSnapshotsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ElasticSnapshotData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticSnapshotOperationSource(Client), + _elasticSnapshotsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotsGetByElasticVolumeAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotsGetByElasticVolumeAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..63275336aeb3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotsGetByElasticVolumeAsyncCollectionResultOfT.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticSnapshotsGetByElasticVolumeAsyncCollectionResultOfT : AsyncPageable + { + private readonly ElasticSnapshots _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticSnapshotsGetByElasticVolumeAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticSnapshots client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The name of the ElasticCapacityPool. + /// The name of the ElasticVolume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public ElasticSnapshotsGetByElasticVolumeAsyncCollectionResultOfT(ElasticSnapshots client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of ElasticSnapshotsGetByElasticVolumeAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticSnapshotsGetByElasticVolumeAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ElasticSnapshotListResult result = ElasticSnapshotListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByElasticVolumeRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetByElasticVolumeRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticSnapshotCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotsGetByElasticVolumeCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotsGetByElasticVolumeCollectionResultOfT.cs new file mode 100644 index 000000000000..8b0f19d1d0ea --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticSnapshotsGetByElasticVolumeCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticSnapshotsGetByElasticVolumeCollectionResultOfT : Pageable + { + private readonly ElasticSnapshots _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticSnapshotsGetByElasticVolumeCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticSnapshots client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The name of the ElasticCapacityPool. + /// The name of the ElasticVolume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public ElasticSnapshotsGetByElasticVolumeCollectionResultOfT(ElasticSnapshots client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of ElasticSnapshotsGetByElasticVolumeCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticSnapshotsGetByElasticVolumeCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ElasticSnapshotListResult result = ElasticSnapshotListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByElasticVolumeRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetByElasticVolumeRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticSnapshotCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeCollection.cs new file mode 100644 index 000000000000..b77885be6d6c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeCollection.cs @@ -0,0 +1,559 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetElasticVolumes method from an instance of the parent resource. + /// + public partial class ElasticVolumeCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _elasticVolumesClientDiagnostics; + private readonly ElasticVolumes _elasticVolumesRestClient; + + /// Initializes a new instance of ElasticVolumeCollection for mocking. + protected ElasticVolumeCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticVolumeCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ElasticVolumeResource.ResourceType, out string elasticVolumeApiVersion); + _elasticVolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ElasticVolumeResource.ResourceType.Namespace, Diagnostics); + _elasticVolumesRestClient = new ElasticVolumes(_elasticVolumesClientDiagnostics, Pipeline, Endpoint, elasticVolumeApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ElasticCapacityPoolResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ElasticCapacityPoolResource.ResourceType), id); + } + } + + /// + /// Create or update the specified volume within the capacity pool + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticVolume. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string volumeName, ElasticVolumeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, ElasticVolumeData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticVolumeOperationSource(Client), + _elasticVolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the specified volume within the capacity pool + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the ElasticVolume. + /// Resource create parameters. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string volumeName, ElasticVolumeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, ElasticVolumeData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticVolumeOperationSource(Client), + _elasticVolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticVolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticVolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all elastic volumes within the elastic capacity pool. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ElasticVolumesGetByElasticPoolAsyncCollectionResultOfT( + _elasticVolumesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new ElasticVolumeResource(Client, data)); + } + + /// List all elastic volumes within the elastic capacity pool. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ElasticVolumesGetByElasticPoolCollectionResultOfT( + _elasticVolumesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new ElasticVolumeResource(Client, data)); + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticVolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticVolumeData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticVolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticVolumeData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticVolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticVolumeData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticVolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((ElasticVolumeData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeData.Serialization.cs new file mode 100644 index 000000000000..51e680c56179 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeData.Serialization.cs @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp elastic capacity pool resource. + public partial class ElasticVolumeData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticVolumeData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("eTag"u8); + writer.WriteStringValue(ETag); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (string item in Zones) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticVolumeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ElasticVolumeData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVolumeData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticVolumeData DeserializeElasticVolumeData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + ElasticVolumeProperties properties = default; + string eTag = default; + IList zones = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticVolumeProperties.DeserializeElasticVolumeProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("eTag"u8)) + { + eTag = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("zones"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + zones = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticVolumeData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + eTag, + zones ?? new ChangeTrackingList()); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVolumeData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticVolumeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ElasticVolumeData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticVolumeData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVolumeData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticVolumeData elasticVolumeData) + { + if (elasticVolumeData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticVolumeData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ElasticVolumeData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticVolumeData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeData.cs new file mode 100644 index 000000000000..7bdf5fc2fa5b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeData.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// NetApp elastic capacity pool resource. + public partial class ElasticVolumeData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public ElasticVolumeData(AzureLocation location) : base(location) + { + Zones = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// The resource-specific properties for this resource. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The availability zones. + internal ElasticVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, ElasticVolumeProperties properties, string eTag, IList zones) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; + Zones = zones; + } + + /// The resource-specific properties for this resource. + public ElasticVolumeProperties Properties { get; set; } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + public string ETag { get; } + + /// The availability zones. + public IList Zones { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeResource.Serialization.cs new file mode 100644 index 000000000000..20fc2e740383 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class ElasticVolumeResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ElasticVolumeData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ElasticVolumeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + ElasticVolumeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeResource.cs new file mode 100644 index 000000000000..20371f772e12 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumeResource.cs @@ -0,0 +1,835 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a ElasticVolume along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetElasticVolumes method. + /// + public partial class ElasticVolumeResource : ArmResource + { + private readonly ClientDiagnostics _elasticVolumesClientDiagnostics; + private readonly ElasticVolumes _elasticVolumesRestClient; + private readonly ElasticVolumeData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/elasticAccounts/elasticCapacityPools/elasticVolumes"; + + /// Initializes a new instance of ElasticVolumeResource for mocking. + protected ElasticVolumeResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ElasticVolumeResource(ArmClient client, ElasticVolumeData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticVolumeResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string elasticVolumeApiVersion); + _elasticVolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _elasticVolumesRestClient = new ElasticVolumes(_elasticVolumesClientDiagnostics, Pipeline, Endpoint, elasticVolumeApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual ElasticVolumeData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified elastic volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticVolumePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ElasticVolumePatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticVolumeOperationSource(Client), + _elasticVolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified elastic volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticVolumePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ElasticVolumePatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticVolumeOperationSource(Client), + _elasticVolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_elasticVolumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}. + /// + /// + /// Operation Id. + /// ElasticVolumes_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_elasticVolumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Revert a volume to the snapshot specified in the body + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/revert. + /// + /// + /// Operation Id. + /// ElasticVolumes_Revert. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual async Task> RevertAsync(WaitUntil waitUntil, ElasticVolumeRevert body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.Revert"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateRevertRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ElasticVolumeRevert.ToRequestContent(body), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticVolumeOperationSource(Client), + _elasticVolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Revert a volume to the snapshot specified in the body + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}/elasticCapacityPools/{poolName}/elasticVolumes/{volumeName}/revert. + /// + /// + /// Operation Id. + /// ElasticVolumes_Revert. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content of the action request. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Revert(WaitUntil waitUntil, ElasticVolumeRevert body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.Revert"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateRevertRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ElasticVolumeRevert.ToRequestContent(body), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ElasticVolumeOperationSource(Client), + _elasticVolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticVolumeData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticVolumePatch patch = new ElasticVolumePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticVolumeData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticVolumePatch patch = new ElasticVolumePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticVolumeData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticVolumePatch patch = new ElasticVolumePatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticVolumeData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticVolumePatch patch = new ElasticVolumePatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticVolumeData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ElasticVolumePatch patch = new ElasticVolumePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _elasticVolumesClientDiagnostics.CreateScope("ElasticVolumeResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _elasticVolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ElasticVolumeData.FromResponse(result), result); + return Response.FromValue(new ElasticVolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + ElasticVolumeData current = Get(cancellationToken: cancellationToken).Value.Data; + ElasticVolumePatch patch = new ElasticVolumePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a collection of ElasticSnapshots in the . + /// An object representing collection of ElasticSnapshots and their operations over a ElasticSnapshotResource. + public virtual ElasticSnapshotCollection GetElasticSnapshots() + { + return GetCachedClient(client => new ElasticSnapshotCollection(client, Id)); + } + + /// Get a ElasticSnapshot. + /// The name of the ElasticSnapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetElasticSnapshotAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + return await GetElasticSnapshots().GetAsync(snapshotName, cancellationToken).ConfigureAwait(false); + } + + /// Get a ElasticSnapshot. + /// The name of the ElasticSnapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetElasticSnapshot(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + return GetElasticSnapshots().Get(snapshotName, cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumesGetByElasticPoolAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumesGetByElasticPoolAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..565984b75050 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumesGetByElasticPoolAsyncCollectionResultOfT.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticVolumesGetByElasticPoolAsyncCollectionResultOfT : AsyncPageable + { + private readonly ElasticVolumes _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticVolumesGetByElasticPoolAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticVolumes client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The name of the ElasticCapacityPool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public ElasticVolumesGetByElasticPoolAsyncCollectionResultOfT(ElasticVolumes client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _context = context; + } + + /// Gets the pages of ElasticVolumesGetByElasticPoolAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticVolumesGetByElasticPoolAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ElasticVolumeListResult result = ElasticVolumeListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByElasticPoolRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _context) : _client.CreateGetByElasticPoolRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticVolumeCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumesGetByElasticPoolCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumesGetByElasticPoolCollectionResultOfT.cs new file mode 100644 index 000000000000..b2fb40eaa83a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ElasticVolumesGetByElasticPoolCollectionResultOfT.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticVolumesGetByElasticPoolCollectionResultOfT : Pageable + { + private readonly ElasticVolumes _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly RequestContext _context; + + /// Initializes a new instance of ElasticVolumesGetByElasticPoolCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ElasticVolumes client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticAccount. + /// The name of the ElasticCapacityPool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public ElasticVolumesGetByElasticPoolCollectionResultOfT(ElasticVolumes client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _context = context; + } + + /// Gets the pages of ElasticVolumesGetByElasticPoolCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ElasticVolumesGetByElasticPoolCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ElasticVolumeListResult result = ElasticVolumeListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByElasticPoolRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _context) : _client.CreateGetByElasticPoolRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ElasticVolumeCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppArmClient.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppArmClient.cs index 3ff808da3bc2..5c5ce0a4ce5c 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppArmClient.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppArmClient.cs @@ -6,188 +6,249 @@ #nullable disable using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Mocking { - /// A class to add extension methods to ArmClient. + /// A class to add extension methods to . public partial class MockableNetAppArmClient : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableNetAppArmClient for mocking. protected MockableNetAppArmClient() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableNetAppArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) { } - internal MockableNetAppArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetAppSubscriptionQuotaItemResource GetNetAppSubscriptionQuotaItemResource(ResourceIdentifier id) { + NetAppSubscriptionQuotaItemResource.ValidateResourceId(id); + return new NetAppSubscriptionQuotaItemResource(Client, id); } - private string GetApiVersionOrNull(ResourceType resourceType) + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual VolumeGroupDetailsResource GetVolumeGroupDetailsResource(ResourceIdentifier id) { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; + VolumeGroupDetailsResource.ValidateResourceId(id); + return new VolumeGroupDetailsResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual RegionInfoResource GetRegionInfoResource(ResourceIdentifier id) + /// Returns a object. + public virtual BackupResource GetBackupResource(ResourceIdentifier id) { - RegionInfoResource.ValidateResourceId(id); - return new RegionInfoResource(Client, id); + BackupResource.ValidateResourceId(id); + return new BackupResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual NetAppAccountResource GetNetAppAccountResource(ResourceIdentifier id) + /// Returns a object. + public virtual VolumeResource GetVolumeResource(ResourceIdentifier id) { - NetAppAccountResource.ValidateResourceId(id); - return new NetAppAccountResource(Client, id); + VolumeResource.ValidateResourceId(id); + return new VolumeResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual CapacityPoolResource GetCapacityPoolResource(ResourceIdentifier id) + /// Returns a object. + public virtual SnapshotResource GetSnapshotResource(ResourceIdentifier id) { - CapacityPoolResource.ValidateResourceId(id); - return new CapacityPoolResource(Client, id); + SnapshotResource.ValidateResourceId(id); + return new SnapshotResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual NetAppVolumeResource GetNetAppVolumeResource(ResourceIdentifier id) + /// Returns a object. + public virtual SnapshotPolicyResource GetSnapshotPolicyResource(ResourceIdentifier id) { - NetAppVolumeResource.ValidateResourceId(id); - return new NetAppVolumeResource(Client, id); + SnapshotPolicyResource.ValidateResourceId(id); + return new SnapshotPolicyResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual NetAppVolumeSnapshotResource GetNetAppVolumeSnapshotResource(ResourceIdentifier id) + /// Returns a object. + public virtual BackupPolicyResource GetBackupPolicyResource(ResourceIdentifier id) { - NetAppVolumeSnapshotResource.ValidateResourceId(id); - return new NetAppVolumeSnapshotResource(Client, id); + BackupPolicyResource.ValidateResourceId(id); + return new BackupPolicyResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual SnapshotPolicyResource GetSnapshotPolicyResource(ResourceIdentifier id) + /// Returns a object. + public virtual VolumeQuotaRuleResource GetVolumeQuotaRuleResource(ResourceIdentifier id) { - SnapshotPolicyResource.ValidateResourceId(id); - return new SnapshotPolicyResource(Client, id); + VolumeQuotaRuleResource.ValidateResourceId(id); + return new VolumeQuotaRuleResource(Client, id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RansomwareReportResource GetRansomwareReportResource(ResourceIdentifier id) + { + RansomwareReportResource.ValidateResourceId(id); + return new RansomwareReportResource(Client, id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BackupVaultResource GetBackupVaultResource(ResourceIdentifier id) + { + BackupVaultResource.ValidateResourceId(id); + return new BackupVaultResource(Client, id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BucketResource GetBucketResource(ResourceIdentifier id) + { + BucketResource.ValidateResourceId(id); + return new BucketResource(Client, id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CacheResource GetCacheResource(ResourceIdentifier id) + { + CacheResource.ValidateResourceId(id); + return new CacheResource(Client, id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ElasticAccountResource GetElasticAccountResource(ResourceIdentifier id) + { + ElasticAccountResource.ValidateResourceId(id); + return new ElasticAccountResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual NetAppBackupPolicyResource GetNetAppBackupPolicyResource(ResourceIdentifier id) + /// Returns a object. + public virtual ElasticCapacityPoolResource GetElasticCapacityPoolResource(ResourceIdentifier id) { - NetAppBackupPolicyResource.ValidateResourceId(id); - return new NetAppBackupPolicyResource(Client, id); + ElasticCapacityPoolResource.ValidateResourceId(id); + return new ElasticCapacityPoolResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual NetAppVolumeQuotaRuleResource GetNetAppVolumeQuotaRuleResource(ResourceIdentifier id) + /// Returns a object. + public virtual ElasticVolumeResource GetElasticVolumeResource(ResourceIdentifier id) { - NetAppVolumeQuotaRuleResource.ValidateResourceId(id); - return new NetAppVolumeQuotaRuleResource(Client, id); + ElasticVolumeResource.ValidateResourceId(id); + return new ElasticVolumeResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual NetAppVolumeGroupResource GetNetAppVolumeGroupResource(ResourceIdentifier id) + /// Returns a object. + public virtual ElasticSnapshotResource GetElasticSnapshotResource(ResourceIdentifier id) { - NetAppVolumeGroupResource.ValidateResourceId(id); - return new NetAppVolumeGroupResource(Client, id); + ElasticSnapshotResource.ValidateResourceId(id); + return new ElasticSnapshotResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual NetAppSubvolumeInfoResource GetNetAppSubvolumeInfoResource(ResourceIdentifier id) + /// Returns a object. + public virtual ElasticSnapshotPolicyResource GetElasticSnapshotPolicyResource(ResourceIdentifier id) { - NetAppSubvolumeInfoResource.ValidateResourceId(id); - return new NetAppSubvolumeInfoResource(Client, id); + ElasticSnapshotPolicyResource.ValidateResourceId(id); + return new ElasticSnapshotPolicyResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual NetAppBackupVaultBackupResource GetNetAppBackupVaultBackupResource(ResourceIdentifier id) + /// Returns a object. + public virtual ElasticBackupVaultResource GetElasticBackupVaultResource(ResourceIdentifier id) { - NetAppBackupVaultBackupResource.ValidateResourceId(id); - return new NetAppBackupVaultBackupResource(Client, id); + ElasticBackupVaultResource.ValidateResourceId(id); + return new ElasticBackupVaultResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual NetAppBackupVaultResource GetNetAppBackupVaultResource(ResourceIdentifier id) + /// Returns a object. + public virtual ElasticBackupPolicyResource GetElasticBackupPolicyResource(ResourceIdentifier id) + { + ElasticBackupPolicyResource.ValidateResourceId(id); + return new ElasticBackupPolicyResource(Client, id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ElasticBackupResource GetElasticBackupResource(ResourceIdentifier id) + { + ElasticBackupResource.ValidateResourceId(id); + return new ElasticBackupResource(Client, id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ActiveDirectoryConfigResource GetActiveDirectoryConfigResource(ResourceIdentifier id) + { + ActiveDirectoryConfigResource.ValidateResourceId(id); + return new ActiveDirectoryConfigResource(Client, id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RegionInfoResource GetRegionInfoResource(ResourceIdentifier id) { - NetAppBackupVaultResource.ValidateResourceId(id); - return new NetAppBackupVaultResource(Client, id); + RegionInfoResource.ValidateResourceId(id); + return new RegionInfoResource(Client, id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual NetAppAccountResource GetNetAppAccountResource(ResourceIdentifier id) + { + NetAppAccountResource.ValidateResourceId(id); + return new NetAppAccountResource(Client, id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CapacityPoolResource GetCapacityPoolResource(ResourceIdentifier id) + { + CapacityPoolResource.ValidateResourceId(id); + return new CapacityPoolResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. - /// Returns a object. - public virtual NetAppBucketResource GetNetAppBucketResource(ResourceIdentifier id) + /// Returns a object. + public virtual SubvolumeInfoResource GetSubvolumeInfoResource(ResourceIdentifier id) { - NetAppBucketResource.ValidateResourceId(id); - return new NetAppBucketResource(Client, id); + SubvolumeInfoResource.ValidateResourceId(id); + return new SubvolumeInfoResource(Client, id); } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppResourceGroupResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppResourceGroupResource.cs index 48d0b04fe774..93fd511b5a2f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppResourceGroupResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppResourceGroupResource.cs @@ -8,33 +8,231 @@ using System; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NetApp.Mocking { - /// A class to add extension methods to ResourceGroupResource. + /// A class to add extension methods to . public partial class MockableNetAppResourceGroupResource : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableNetAppResourceGroupResource for mocking. protected MockableNetAppResourceGroupResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableNetAppResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private string GetApiVersionOrNull(ResourceType resourceType) + /// Gets a collection of NetAppSubscriptionQuotaItems in the . + /// The accountName for the resource. + /// An object representing collection of NetAppSubscriptionQuotaItems and their operations over a NetAppSubscriptionQuotaItemResource. + public virtual NetAppSubscriptionQuotaItemCollection GetNetAppSubscriptionQuotaItems(string accountName) { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; + return GetCachedClient(client => new NetAppSubscriptionQuotaItemCollection(client, Id, accountName)); } - /// Gets a collection of NetAppAccountResources in the ResourceGroupResource. - /// An object representing collection of NetAppAccountResources and their operations over a NetAppAccountResource. + /// + /// Get the default and current quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// SubscriptionQuotaItems_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The accountName for the resource. + /// The name of the Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetAppSubscriptionQuotaItemAsync(string accountName, AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + + return await GetNetAppSubscriptionQuotaItems(accountName).GetAsync(location, quotaLimitName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the default and current quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// SubscriptionQuotaItems_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The accountName for the resource. + /// The name of the Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetAppSubscriptionQuotaItem(string accountName, AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + + return GetNetAppSubscriptionQuotaItems(accountName).Get(location, quotaLimitName, cancellationToken); + } + + /// Gets a collection of ElasticAccounts in the . + /// An object representing collection of ElasticAccounts and their operations over a ElasticAccountResource. + public virtual ElasticAccountCollection GetElasticAccounts() + { + return GetCachedClient(client => new ElasticAccountCollection(client, Id)); + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetElasticAccountAsync(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + return await GetElasticAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the NetApp elastic account + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/elasticAccounts/{accountName}. + /// + /// + /// Operation Id. + /// ElasticAccounts_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ElasticAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetElasticAccount(string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + return GetElasticAccounts().Get(accountName, cancellationToken); + } + + /// Gets a collection of ActiveDirectoryConfigs in the . + /// An object representing collection of ActiveDirectoryConfigs and their operations over a ActiveDirectoryConfigResource. + public virtual ActiveDirectoryConfigCollection GetActiveDirectoryConfigs() + { + return GetCachedClient(client => new ActiveDirectoryConfigCollection(client, Id)); + } + + /// + /// Get the details of the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the NetAppAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetActiveDirectoryConfigAsync(string activeDirectoryConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activeDirectoryConfigName, nameof(activeDirectoryConfigName)); + + return await GetActiveDirectoryConfigs().GetAsync(activeDirectoryConfigName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the details of the specified active directory configuration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/activeDirectoryConfigs/{activeDirectoryConfigName}. + /// + /// + /// Operation Id. + /// ActiveDirectoryConfigs_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the NetAppAccount. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetActiveDirectoryConfig(string activeDirectoryConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(activeDirectoryConfigName, nameof(activeDirectoryConfigName)); + + return GetActiveDirectoryConfigs().Get(activeDirectoryConfigName, cancellationToken); + } + + /// Gets a collection of NetAppAccounts in the . + /// An object representing collection of NetAppAccounts and their operations over a NetAppAccountResource. public virtual NetAppAccountCollection GetNetAppAccounts() { return GetCachedClient(client => new NetAppAccountCollection(client, Id)); @@ -44,20 +242,16 @@ public virtual NetAppAccountCollection GetNetAppAccounts() /// Get the NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// NetAppAccounts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// @@ -68,6 +262,8 @@ public virtual NetAppAccountCollection GetNetAppAccounts() [ForwardsClientCalls] public virtual async Task> GetNetAppAccountAsync(string accountName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + return await GetNetAppAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); } @@ -75,20 +271,16 @@ public virtual async Task> GetNetAppAccountAsync /// Get the NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Operation Id - /// Accounts_Get + /// Operation Id. + /// NetAppAccounts_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// @@ -99,6 +291,8 @@ public virtual async Task> GetNetAppAccountAsync [ForwardsClientCalls] public virtual Response GetNetAppAccount(string accountName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + return GetNetAppAccounts().Get(accountName, cancellationToken); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppSubscriptionResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppSubscriptionResource.cs index 9b3991658036..5bce55a6b28f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppSubscriptionResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppSubscriptionResource.cs @@ -8,226 +8,219 @@ using System; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp; using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NetApp.Mocking { - /// A class to add extension methods to SubscriptionResource. + /// A class to add extension methods to . public partial class MockableNetAppSubscriptionResource : ArmResource { + private ClientDiagnostics _netAppResourceQuotaLimitsClientDiagnostics; + private NetAppResourceQuotaLimits _netAppResourceQuotaLimitsRestClient; + private ClientDiagnostics _elasticAccountsClientDiagnostics; + private ElasticAccounts _elasticAccountsRestClient; + private ClientDiagnostics _activeDirectoryConfigsClientDiagnostics; + private ActiveDirectoryConfigs _activeDirectoryConfigsRestClient; + private ClientDiagnostics _accountsClientDiagnostics; + private Accounts _accountsRestClient; private ClientDiagnostics _netAppResourceClientDiagnostics; - private NetAppResourceRestOperations _netAppResourceRestClient; + private NetAppResource _netAppResourceRestClient; private ClientDiagnostics _netAppResourceUsagesClientDiagnostics; - private NetAppResourceUsagesRestOperations _netAppResourceUsagesRestClient; - private ClientDiagnostics _netAppResourceQuotaLimitsClientDiagnostics; - private NetAppResourceQuotaLimitsRestOperations _netAppResourceQuotaLimitsRestClient; - private ClientDiagnostics _netAppAccountAccountsClientDiagnostics; - private AccountsRestOperations _netAppAccountAccountsRestClient; + private NetAppResourceUsages _netAppResourceUsagesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableNetAppSubscriptionResource for mocking. protected MockableNetAppSubscriptionResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableNetAppSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private ClientDiagnostics NetAppResourceClientDiagnostics => _netAppResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private NetAppResourceRestOperations NetAppResourceRestClient => _netAppResourceRestClient ??= new NetAppResourceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics NetAppResourceUsagesClientDiagnostics => _netAppResourceUsagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private NetAppResourceUsagesRestOperations NetAppResourceUsagesRestClient => _netAppResourceUsagesRestClient ??= new NetAppResourceUsagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics NetAppResourceQuotaLimitsClientDiagnostics => _netAppResourceQuotaLimitsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private NetAppResourceQuotaLimitsRestOperations NetAppResourceQuotaLimitsRestClient => _netAppResourceQuotaLimitsRestClient ??= new NetAppResourceQuotaLimitsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - private ClientDiagnostics NetAppAccountAccountsClientDiagnostics => _netAppAccountAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppAccountResource.ResourceType.Namespace, Diagnostics); - private AccountsRestOperations NetAppAccountAccountsRestClient => _netAppAccountAccountsRestClient ??= new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NetAppAccountResource.ResourceType)); + private ClientDiagnostics NetAppResourceQuotaLimitsClientDiagnostics => _netAppResourceQuotaLimitsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } + private NetAppResourceQuotaLimits NetAppResourceQuotaLimitsRestClient => _netAppResourceQuotaLimitsRestClient ??= new NetAppResourceQuotaLimits(NetAppResourceQuotaLimitsClientDiagnostics, Pipeline, Endpoint, "2025-09-01-preview"); - /// Gets a collection of RegionInfoResources in the SubscriptionResource. - /// The name of the Azure region. - /// An object representing collection of RegionInfoResources and their operations over a RegionInfoResource. - public virtual RegionInfoResourceCollection GetRegionInfoResources(AzureLocation location) - { - return new RegionInfoResourceCollection(Client, Id, location); - } + private ClientDiagnostics ElasticAccountsClientDiagnostics => _elasticAccountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); + + private ElasticAccounts ElasticAccountsRestClient => _elasticAccountsRestClient ??= new ElasticAccounts(ElasticAccountsClientDiagnostics, Pipeline, Endpoint, "2025-09-01-preview"); + + private ClientDiagnostics ActiveDirectoryConfigsClientDiagnostics => _activeDirectoryConfigsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); + + private ActiveDirectoryConfigs ActiveDirectoryConfigsRestClient => _activeDirectoryConfigsRestClient ??= new ActiveDirectoryConfigs(ActiveDirectoryConfigsClientDiagnostics, Pipeline, Endpoint, "2025-09-01-preview"); + + private ClientDiagnostics AccountsClientDiagnostics => _accountsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); + + private Accounts AccountsRestClient => _accountsRestClient ??= new Accounts(AccountsClientDiagnostics, Pipeline, Endpoint, "2025-09-01-preview"); + + private ClientDiagnostics NetAppResourceClientDiagnostics => _netAppResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); + + private NetAppResource NetAppResourceRestClient => _netAppResourceRestClient ??= new NetAppResource(NetAppResourceClientDiagnostics, Pipeline, Endpoint, "2025-09-01-preview"); + + private ClientDiagnostics NetAppResourceUsagesClientDiagnostics => _netAppResourceUsagesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); + + private NetAppResourceUsages NetAppResourceUsagesRestClient => _netAppResourceUsagesRestClient ??= new NetAppResourceUsages(NetAppResourceUsagesClientDiagnostics, Pipeline, Endpoint, "2025-09-01-preview"); /// /// Provides storage to network proximity and logical zone mapping information. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default. /// /// - /// Operation Id - /// NetAppResourceRegionInfos_Get + /// Operation Id. + /// RegionInfoResources_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// + /// Returns a object. + public virtual RegionInfoResource GetRegionInfoResource() + { + return new RegionInfoResource(Client, Id.AppendProviderResource("Microsoft.NetApp", "locations", "default")); + } + + /// Get the default and current limits for quotas. /// The name of the Azure region. /// The cancellation token to use. - [ForwardsClientCalls] - public virtual async Task> GetRegionInfoResourceAsync(AzureLocation location, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetAppSubscriptionQuotaItemsAsync(AzureLocation location, CancellationToken cancellationToken = default) { - return await GetRegionInfoResources(location).GetAsync(cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new NetAppResourceQuotaLimitsGetAllAsyncCollectionResultOfT(NetAppResourceQuotaLimitsRestClient, Guid.Parse(Id.SubscriptionId), location, context), data => new NetAppSubscriptionQuotaItemResource(Client, data)); } - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Get the default and current limits for quotas. /// The name of the Azure region. /// The cancellation token to use. - [ForwardsClientCalls] - public virtual Response GetRegionInfoResource(AzureLocation location, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetAppSubscriptionQuotaItems(AzureLocation location, CancellationToken cancellationToken = default) { - return GetRegionInfoResources(location).Get(cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new NetAppResourceQuotaLimitsGetAllCollectionResultOfT(NetAppResourceQuotaLimitsRestClient, Guid.Parse(Id.SubscriptionId), location, context), data => new NetAppSubscriptionQuotaItemResource(Client, data)); } - /// - /// Check if a resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckNameAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. - /// Name availability request. + /// List and describe all NetApp elastic accounts in the subscription. /// The cancellation token to use. - /// is null. - public virtual async Task> CheckNetAppNameAvailabilityAsync(AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetElasticAccountsAsync(CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ElasticAccountsGetBySubscriptionAsyncCollectionResultOfT(ElasticAccountsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new ElasticAccountResource(Client, data)); + } - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppNameAvailability"); - scope.Start(); - try + /// List and describe all NetApp elastic accounts in the subscription. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetElasticAccounts(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext { - var response = await NetAppResourceRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ElasticAccountsGetBySubscriptionCollectionResultOfT(ElasticAccountsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new ElasticAccountResource(Client, data)); + } + + /// List all active directory configurations within the subscription. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetActiveDirectoryConfigsAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext { - scope.Failed(e); - throw; - } + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ActiveDirectoryConfigsGetBySubscriptionAsyncCollectionResultOfT(ActiveDirectoryConfigsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new ActiveDirectoryConfigResource(Client, data)); } - /// - /// Check if a resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckNameAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. - /// Name availability request. + /// List all active directory configurations within the subscription. /// The cancellation token to use. - /// is null. - public virtual Response CheckNetAppNameAvailability(AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetActiveDirectoryConfigs(CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ActiveDirectoryConfigsGetBySubscriptionCollectionResultOfT(ActiveDirectoryConfigsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new ActiveDirectoryConfigResource(Client, data)); + } - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppNameAvailability"); - scope.Start(); - try + /// List and describe all NetApp accounts in the subscription. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNetAppAccountsAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext { - var response = NetAppResourceRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); - return response; - } - catch (Exception e) + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new AccountsGetBySubscriptionAsyncCollectionResultOfT(AccountsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new NetAppAccountResource(Client, data)); + } + + /// List and describe all NetApp accounts in the subscription. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNetAppAccounts(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext { - scope.Failed(e); - throw; - } + CancellationToken = cancellationToken + }; + return new PageableWrapper(new AccountsGetBySubscriptionCollectionResultOfT(AccountsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new NetAppAccountResource(Client, data)); } - /// - /// Check if a file path is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckFilePathAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. - /// File path availability request. + /// Check if a resource name is available. + /// The location name. + /// The request body. /// The cancellation token to use. - /// is null. - public virtual async Task> CheckNetAppFilePathAvailabilityAsync(AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CheckNameAvailabilityAsync(string location, ResourceNameAvailabilityRequest content, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNull(content, nameof(content)); - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppFilePathAvailability"); + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNameAvailability"); scope.Start(); try { - var response = await NetAppResourceRestClient.CheckFilePathAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateCheckNameAvailabilityRequest(Guid.Parse(Id.SubscriptionId), location, ResourceNameAvailabilityRequest.ToRequestContent(content), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CheckAvailabilityResponse.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -237,36 +230,32 @@ public virtual async Task> CheckNetAppFi } } - /// - /// Check if a file path is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckFilePathAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. - /// File path availability request. + /// Check if a resource name is available. + /// The location name. + /// The request body. /// The cancellation token to use. - /// is null. - public virtual Response CheckNetAppFilePathAvailability(AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response CheckNameAvailability(string location, ResourceNameAvailabilityRequest content, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNull(content, nameof(content)); - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppFilePathAvailability"); + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNameAvailability"); scope.Start(); try { - var response = NetAppResourceRestClient.CheckFilePathAvailability(Id.SubscriptionId, location, content, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateCheckNameAvailabilityRequest(Guid.Parse(Id.SubscriptionId), location, ResourceNameAvailabilityRequest.ToRequestContent(content), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CheckAvailabilityResponse.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -276,36 +265,32 @@ public virtual Response CheckNetAppFilePathAvaila } } - /// - /// Check if a quota is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckQuotaAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. - /// Quota availability request. + /// Check if a file path is available. + /// The location name. + /// The request body. /// The cancellation token to use. - /// is null. - public virtual async Task> CheckNetAppQuotaAvailabilityAsync(AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CheckFilePathAvailabilityAsync(string location, FilePathAvailabilityRequest content, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNull(content, nameof(content)); - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppQuotaAvailability"); + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckFilePathAvailability"); scope.Start(); try { - var response = await NetAppResourceRestClient.CheckQuotaAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateCheckFilePathAvailabilityRequest(Guid.Parse(Id.SubscriptionId), location, FilePathAvailabilityRequest.ToRequestContent(content), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CheckAvailabilityResponse.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -315,36 +300,32 @@ public virtual async Task> CheckNetAppQu } } - /// - /// Check if a quota is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckQuotaAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. - /// Quota availability request. + /// Check if a file path is available. + /// The location name. + /// The request body. /// The cancellation token to use. - /// is null. - public virtual Response CheckNetAppQuotaAvailability(AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response CheckFilePathAvailability(string location, FilePathAvailabilityRequest content, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNull(content, nameof(content)); - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckNetAppQuotaAvailability"); + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckFilePathAvailability"); scope.Start(); try { - var response = NetAppResourceRestClient.CheckQuotaAvailability(Id.SubscriptionId, location, content, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateCheckFilePathAvailabilityRequest(Guid.Parse(Id.SubscriptionId), location, FilePathAvailabilityRequest.ToRequestContent(content), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CheckAvailabilityResponse.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -354,32 +335,32 @@ public virtual Response CheckNetAppQuotaAvailabil } } - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo - /// - /// - /// Operation Id - /// NetAppResource_QueryRegionInfo - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. + /// Check if a quota is available. + /// The location name. + /// The request body. /// The cancellation token to use. - public virtual async Task> QueryRegionInfoNetAppResourceAsync(AzureLocation location, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CheckQuotaAvailabilityAsync(string location, QuotaAvailabilityRequest content, CancellationToken cancellationToken = default) { - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryRegionInfoNetAppResource"); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckQuotaAvailability"); scope.Start(); try { - var response = await NetAppResourceRestClient.QueryRegionInfoAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateCheckQuotaAvailabilityRequest(Guid.Parse(Id.SubscriptionId), location, QuotaAvailabilityRequest.ToRequestContent(content), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CheckAvailabilityResponse.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -389,32 +370,32 @@ public virtual async Task> QueryRegionInfoNetAppResou } } - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo - /// - /// - /// Operation Id - /// NetAppResource_QueryRegionInfo - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. + /// Check if a quota is available. + /// The location name. + /// The request body. /// The cancellation token to use. - public virtual Response QueryRegionInfoNetAppResource(AzureLocation location, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response CheckQuotaAvailability(string location, QuotaAvailabilityRequest content, CancellationToken cancellationToken = default) { - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryRegionInfoNetAppResource"); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.CheckQuotaAvailability"); scope.Start(); try { - var response = NetAppResourceRestClient.QueryRegionInfo(Id.SubscriptionId, location, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateCheckQuotaAvailabilityRequest(Guid.Parse(Id.SubscriptionId), location, QuotaAvailabilityRequest.ToRequestContent(content), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CheckAvailabilityResponse.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -425,35 +406,45 @@ public virtual Response QueryRegionInfoNetAppResource(AzureLoc } /// - /// Get details of the specified network sibling set. + /// Provides storage to network proximity and logical zone mapping information. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/queryNetworkSiblingSet + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo. /// /// - /// Operation Id - /// NetAppResource_QueryNetworkSiblingSet + /// Operation Id. + /// NetAppResourceOperationGroup_QueryRegionInfo. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// - /// The name of the Azure region. - /// Network sibling set to query. + /// The location name. /// The cancellation token to use. - /// is null. - public virtual async Task> QueryNetworkSiblingSetNetAppResourceAsync(AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> QueryRegionInfoAsync(string location, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryNetworkSiblingSetNetAppResource"); + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryRegionInfo"); scope.Start(); try { - var response = await NetAppResourceRestClient.QueryNetworkSiblingSetAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateQueryRegionInfoRequest(Guid.Parse(Id.SubscriptionId), location, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(RegionInfo.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -464,35 +455,45 @@ public virtual async Task> QueryNetworkSiblingSetNet } /// - /// Get details of the specified network sibling set. + /// Provides storage to network proximity and logical zone mapping information. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/queryNetworkSiblingSet + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo. /// /// - /// Operation Id - /// NetAppResource_QueryNetworkSiblingSet + /// Operation Id. + /// NetAppResourceOperationGroup_QueryRegionInfo. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// - /// The name of the Azure region. - /// Network sibling set to query. + /// The location name. /// The cancellation token to use. - /// is null. - public virtual Response QueryNetworkSiblingSetNetAppResource(AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response QueryRegionInfo(string location, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryNetworkSiblingSetNetAppResource"); + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryRegionInfo"); scope.Start(); try { - var response = NetAppResourceRestClient.QueryNetworkSiblingSet(Id.SubscriptionId, location, content, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateQueryRegionInfoRequest(Guid.Parse(Id.SubscriptionId), location, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(RegionInfo.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -502,41 +503,33 @@ public virtual Response QueryNetworkSiblingSetNetAppResource( } } - /// - /// Update the network features of the specified network sibling set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/updateNetworkSiblingSet - /// - /// - /// Operation Id - /// NetAppResource_UpdateNetworkSiblingSet - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the Azure region. - /// Update for the specified network sibling set. + /// Get details of the specified network sibling set. + /// The location name. + /// The request body. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateNetworkSiblingSetNetAppResourceAsync(WaitUntil waitUntil, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> QueryNetworkSiblingSetAsync(string location, QueryNetworkSiblingSetRequest content, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNull(content, nameof(content)); - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.UpdateNetworkSiblingSetNetAppResource"); + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryNetworkSiblingSet"); scope.Start(); try { - var response = await NetAppResourceRestClient.UpdateNetworkSiblingSetAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetworkSiblingSetOperationSource(), NetAppResourceClientDiagnostics, Pipeline, NetAppResourceRestClient.CreateUpdateNetworkSiblingSetRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateQueryNetworkSiblingSetRequest(Guid.Parse(Id.SubscriptionId), location, QueryNetworkSiblingSetRequest.ToRequestContent(content), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetworkSiblingSet.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; } catch (Exception e) { @@ -545,41 +538,33 @@ public virtual async Task> UpdateNetworkSiblingS } } - /// - /// Update the network features of the specified network sibling set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/updateNetworkSiblingSet - /// - /// - /// Operation Id - /// NetAppResource_UpdateNetworkSiblingSet - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the Azure region. - /// Update for the specified network sibling set. + /// Get details of the specified network sibling set. + /// The location name. + /// The request body. /// The cancellation token to use. - /// is null. - public virtual ArmOperation UpdateNetworkSiblingSetNetAppResource(WaitUntil waitUntil, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response QueryNetworkSiblingSet(string location, QueryNetworkSiblingSetRequest content, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNull(content, nameof(content)); - using var scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.UpdateNetworkSiblingSetNetAppResource"); + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.QueryNetworkSiblingSet"); scope.Start(); try { - var response = NetAppResourceRestClient.UpdateNetworkSiblingSet(Id.SubscriptionId, location, content, cancellationToken); - var operation = new NetAppArmOperation(new NetworkSiblingSetOperationSource(), NetAppResourceClientDiagnostics, Pipeline, NetAppResourceRestClient.CreateUpdateNetworkSiblingSetRequest(Id.SubscriptionId, location, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateQueryNetworkSiblingSetRequest(Guid.Parse(Id.SubscriptionId), location, QueryNetworkSiblingSetRequest.ToRequestContent(content), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetworkSiblingSet.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; } catch (Exception e) { @@ -588,91 +573,32 @@ public virtual ArmOperation UpdateNetworkSiblingSetNetAppReso } } - /// - /// Get current subscription usages - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/usages - /// - /// - /// Operation Id - /// NetAppResourceUsages_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. + /// Update the network features of the specified network sibling set. + /// The location name. + /// The request body. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetAppResourceUsagesAsync(AzureLocation location, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> UpdateNetworkSiblingSetAsync(string location, UpdateNetworkSiblingSetRequest content, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppResourceUsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetAppResourceUsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => NetAppUsageResult.DeserializeNetAppUsageResult(e), NetAppResourceUsagesClientDiagnostics, Pipeline, "MockableNetAppSubscriptionResource.GetNetAppResourceUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Get current subscription usages - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/usages - /// - /// - /// Operation Id - /// NetAppResourceUsages_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetAppResourceUsages(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppResourceUsagesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetAppResourceUsagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => NetAppUsageResult.DeserializeNetAppUsageResult(e), NetAppResourceUsagesClientDiagnostics, Pipeline, "MockableNetAppSubscriptionResource.GetNetAppResourceUsages", "value", "nextLink", cancellationToken); - } - - /// - /// Get current subscription usage of the specific type - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/usages/{usageType} - /// - /// - /// Operation Id - /// NetAppResourceUsages_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. - /// The type of usage. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetNetAppResourceUsageAsync(AzureLocation location, string usageType, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(usageType, nameof(usageType)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = NetAppResourceUsagesClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetNetAppResourceUsage"); + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.UpdateNetworkSiblingSet"); scope.Start(); try { - var response = await NetAppResourceUsagesRestClient.GetAsync(Id.SubscriptionId, location, usageType, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateUpdateNetworkSiblingSetRequest(Guid.Parse(Id.SubscriptionId), location, UpdateNetworkSiblingSetRequest.ToRequestContent(content), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetworkSiblingSet.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -682,37 +608,32 @@ public virtual async Task> GetNetAppResourceUsageAsy } } - /// - /// Get current subscription usage of the specific type - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/usages/{usageType} - /// - /// - /// Operation Id - /// NetAppResourceUsages_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. - /// The type of usage. + /// Update the network features of the specified network sibling set. + /// The location name. + /// The request body. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response GetNetAppResourceUsage(AzureLocation location, string usageType, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response UpdateNetworkSiblingSet(string location, UpdateNetworkSiblingSetRequest content, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(usageType, nameof(usageType)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = NetAppResourceUsagesClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetNetAppResourceUsage"); + using DiagnosticScope scope = NetAppResourceClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.UpdateNetworkSiblingSet"); scope.Start(); try { - var response = NetAppResourceUsagesRestClient.Get(Id.SubscriptionId, location, usageType, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceRestClient.CreateUpdateNetworkSiblingSetRequest(Guid.Parse(Id.SubscriptionId), location, UpdateNetworkSiblingSetRequest.ToRequestContent(content), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetworkSiblingSet.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -722,91 +643,81 @@ public virtual Response GetNetAppResourceUsage(AzureLocation } } - /// - /// Get the default and current limits for quotas - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimits_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. + /// Get current subscription usages. + /// The location name. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetAppQuotaLimitsAsync(AzureLocation location, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string location, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppResourceQuotaLimitsRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetAppResourceQuotaLimitsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem(e), NetAppResourceQuotaLimitsClientDiagnostics, Pipeline, "MockableNetAppSubscriptionResource.GetNetAppQuotaLimits", "value", "nextLink", cancellationToken); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new NetAppResourceUsagesGetAllAsyncCollectionResultOfT(NetAppResourceUsagesRestClient, Guid.Parse(Id.SubscriptionId), location, context); } - /// - /// Get the default and current limits for quotas - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimits_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The name of the Azure region. + /// Get current subscription usages. + /// The location name. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetAppQuotaLimits(AzureLocation location, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string location, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppResourceQuotaLimitsRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetAppResourceQuotaLimitsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem(e), NetAppResourceQuotaLimitsClientDiagnostics, Pipeline, "MockableNetAppSubscriptionResource.GetNetAppQuotaLimits", "value", "nextLink", cancellationToken); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new NetAppResourceUsagesGetAllCollectionResultOfT(NetAppResourceUsagesRestClient, Guid.Parse(Id.SubscriptionId), location, context); } /// - /// Get the default and current subscription quota limit + /// Get current subscription usage of the specific type /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName} + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/usages/{usageType}. /// /// - /// Operation Id - /// NetAppResourceQuotaLimits_Get + /// Operation Id. + /// NetAppResourceUsagesOperationGroup_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the Azure region. - /// The name of the Quota Limit. + /// The type of usage. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetNetAppQuotaLimitAsync(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(AzureLocation location, string usageType, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + Argument.AssertNotNullOrEmpty(usageType, nameof(usageType)); - using var scope = NetAppResourceQuotaLimitsClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetNetAppQuotaLimit"); + using DiagnosticScope scope = NetAppResourceUsagesClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.Get"); scope.Start(); try { - var response = await NetAppResourceQuotaLimitsRestClient.GetAsync(Id.SubscriptionId, location, quotaLimitName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceUsagesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), location, usageType, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(UsageResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -817,36 +728,46 @@ public virtual async Task> GetNetAppQuotaL } /// - /// Get the default and current subscription quota limit + /// Get current subscription usage of the specific type /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName} + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/usages/{usageType}. /// /// - /// Operation Id - /// NetAppResourceQuotaLimits_Get + /// Operation Id. + /// NetAppResourceUsagesOperationGroup_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the Azure region. - /// The name of the Quota Limit. + /// The type of usage. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response GetNetAppQuotaLimit(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(AzureLocation location, string usageType, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + Argument.AssertNotNullOrEmpty(usageType, nameof(usageType)); - using var scope = NetAppResourceQuotaLimitsClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetNetAppQuotaLimit"); + using DiagnosticScope scope = NetAppResourceUsagesClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.Get"); scope.Start(); try { - var response = NetAppResourceQuotaLimitsRestClient.Get(Id.SubscriptionId, location, quotaLimitName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = NetAppResourceUsagesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), location, usageType, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(UsageResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -855,65 +776,5 @@ public virtual Response GetNetAppQuotaLimit(AzureLo throw; } } - - /// - /// List and describe all NetApp accounts in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetAppAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetAppAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetAppAccountResource(Client, NetAppAccountData.DeserializeNetAppAccountData(e)), NetAppAccountAccountsClientDiagnostics, Pipeline, "MockableNetAppSubscriptionResource.GetNetAppAccounts", "value", "nextLink", cancellationToken); - } - - /// - /// List and describe all NetApp accounts in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetAppAccounts(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => NetAppAccountAccountsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NetAppAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetAppAccountResource(Client, NetAppAccountData.DeserializeNetAppAccountData(e)), NetAppAccountAccountsClientDiagnostics, Pipeline, "MockableNetAppSubscriptionResource.GetNetAppAccounts", "value", "nextLink", cancellationToken); - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppTenantResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppTenantResource.cs new file mode 100644 index 000000000000..9dcab3e993d2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/MockableNetAppTenantResource.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp; +using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp.Mocking +{ + /// A class to add extension methods to . + public partial class MockableNetAppTenantResource : ArmResource + { + private ClientDiagnostics _operationsClientDiagnostics; + private Operations _operationsRestClient; + + /// Initializes a new instance of MockableNetAppTenantResource for mocking. + protected MockableNetAppTenantResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableNetAppTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OperationsClientDiagnostics => _operationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NetApp.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); + + private Operations OperationsRestClient => _operationsRestClient ??= new Operations(OperationsClientDiagnostics, Pipeline, Endpoint, "2025-09-01-preview"); + + /// List the operations for the provider. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new OperationsGetAllAsyncCollectionResultOfT(OperationsRestClient, context); + } + + /// List the operations for the provider. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new OperationsGetAllCollectionResultOfT(OperationsRestClient, context); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/NetAppExtensions.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/NetAppExtensions.cs index aa99d7597af8..17b09da6acd5 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/NetAppExtensions.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Extensions/NetAppExtensions.cs @@ -8,7 +8,9 @@ using System; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; using Azure.ResourceManager.NetApp.Mocking; using Azure.ResourceManager.NetApp.Models; using Azure.ResourceManager.Resources; @@ -18,125 +20,92 @@ namespace Azure.ResourceManager.NetApp /// A class to add extension methods to Azure.ResourceManager.NetApp. public static partial class NetAppExtensions { + /// private static MockableNetAppArmClient GetMockableNetAppArmClient(ArmClient client) { - return client.GetCachedClient(client0 => new MockableNetAppArmClient(client0)); + return client.GetCachedClient(client0 => new MockableNetAppArmClient(client0, ResourceIdentifier.Root)); } - private static MockableNetAppResourceGroupResource GetMockableNetAppResourceGroupResource(ArmResource resource) + /// + private static MockableNetAppResourceGroupResource GetMockableNetAppResourceGroupResource(ResourceGroupResource resourceGroupResource) { - return resource.GetCachedClient(client => new MockableNetAppResourceGroupResource(client, resource.Id)); + return resourceGroupResource.GetCachedClient(client => new MockableNetAppResourceGroupResource(client, resourceGroupResource.Id)); } - private static MockableNetAppSubscriptionResource GetMockableNetAppSubscriptionResource(ArmResource resource) + /// + private static MockableNetAppSubscriptionResource GetMockableNetAppSubscriptionResource(SubscriptionResource subscriptionResource) { - return resource.GetCachedClient(client => new MockableNetAppSubscriptionResource(client, resource.Id)); + return subscriptionResource.GetCachedClient(client => new MockableNetAppSubscriptionResource(client, subscriptionResource.Id)); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// + private static MockableNetAppTenantResource GetMockableNetAppTenantResource(TenantResource tenantResource) + { + return tenantResource.GetCachedClient(client => new MockableNetAppTenantResource(client, tenantResource.Id)); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static RegionInfoResource GetRegionInfoResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static NetAppSubscriptionQuotaItemResource GetNetAppSubscriptionQuotaItemResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetRegionInfoResource(id); + return GetMockableNetAppArmClient(client).GetNetAppSubscriptionQuotaItemResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NetAppAccountResource GetNetAppAccountResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static VolumeGroupDetailsResource GetVolumeGroupDetailsResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetNetAppAccountResource(id); + return GetMockableNetAppArmClient(client).GetVolumeGroupDetailsResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static CapacityPoolResource GetCapacityPoolResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static BackupResource GetBackupResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetCapacityPoolResource(id); + return GetMockableNetAppArmClient(client).GetBackupResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NetAppVolumeResource GetNetAppVolumeResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static VolumeResource GetVolumeResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetNetAppVolumeResource(id); + return GetMockableNetAppArmClient(client).GetVolumeResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NetAppVolumeSnapshotResource GetNetAppVolumeSnapshotResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static SnapshotResource GetSnapshotResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetNetAppVolumeSnapshotResource(id); + return GetMockableNetAppArmClient(client).GetSnapshotResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. /// Returns a object. @@ -147,149 +116,354 @@ public static SnapshotPolicyResource GetSnapshotPolicyResource(this ArmClient cl return GetMockableNetAppArmClient(client).GetSnapshotPolicyResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static BackupPolicyResource GetBackupPolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetBackupPolicyResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NetAppBackupPolicyResource GetNetAppBackupPolicyResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static VolumeQuotaRuleResource GetVolumeQuotaRuleResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetNetAppBackupPolicyResource(id); + return GetMockableNetAppArmClient(client).GetVolumeQuotaRuleResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NetAppVolumeQuotaRuleResource GetNetAppVolumeQuotaRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static RansomwareReportResource GetRansomwareReportResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetNetAppVolumeQuotaRuleResource(id); + return GetMockableNetAppArmClient(client).GetRansomwareReportResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NetAppVolumeGroupResource GetNetAppVolumeGroupResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static BackupVaultResource GetBackupVaultResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetNetAppVolumeGroupResource(id); + return GetMockableNetAppArmClient(client).GetBackupVaultResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NetAppSubvolumeInfoResource GetNetAppSubvolumeInfoResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static BucketResource GetBucketResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetNetAppSubvolumeInfoResource(id); + return GetMockableNetAppArmClient(client).GetBucketResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NetAppBackupVaultBackupResource GetNetAppBackupVaultBackupResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static CacheResource GetCacheResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetNetAppBackupVaultBackupResource(id); + return GetMockableNetAppArmClient(client).GetCacheResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NetAppBackupVaultResource GetNetAppBackupVaultResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ElasticAccountResource GetElasticAccountResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetNetAppBackupVaultResource(id); + return GetMockableNetAppArmClient(client).GetElasticAccountResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static NetAppBucketResource GetNetAppBucketResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ElasticCapacityPoolResource GetElasticCapacityPoolResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableNetAppArmClient(client).GetNetAppBucketResource(id); + return GetMockableNetAppArmClient(client).GetElasticCapacityPoolResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ElasticVolumeResource GetElasticVolumeResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetElasticVolumeResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ElasticSnapshotResource GetElasticSnapshotResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetElasticSnapshotResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ElasticSnapshotPolicyResource GetElasticSnapshotPolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetElasticSnapshotPolicyResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ElasticBackupVaultResource GetElasticBackupVaultResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetElasticBackupVaultResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ElasticBackupPolicyResource GetElasticBackupPolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetElasticBackupPolicyResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ElasticBackupResource GetElasticBackupResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetElasticBackupResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ActiveDirectoryConfigResource GetActiveDirectoryConfigResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetActiveDirectoryConfigResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static RegionInfoResource GetRegionInfoResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetRegionInfoResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static NetAppAccountResource GetNetAppAccountResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetNetAppAccountResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static CapacityPoolResource GetCapacityPoolResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetCapacityPoolResource(id); + } + + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SubvolumeInfoResource GetSubvolumeInfoResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNetAppArmClient(client).GetSubvolumeInfoResource(id); + } + + /// Gets a collection of NetAppSubscriptionQuotaItems in the . + /// The the method will execute against. + /// The accountName for the resource. + /// is null. + /// An object representing collection of NetAppSubscriptionQuotaItems and their operations over a NetAppSubscriptionQuotaItemResource. + public static NetAppSubscriptionQuotaItemCollection GetNetAppSubscriptionQuotaItems(this ResourceGroupResource resourceGroupResource, string accountName) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableNetAppResourceGroupResource(resourceGroupResource).GetNetAppSubscriptionQuotaItems(accountName); + } + + /// Get the default and current quota limit. + /// The the method will execute against. + /// The accountName for the resource. + /// The name of the Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public static async Task> GetNetAppSubscriptionQuotaItemAsync(this ResourceGroupResource resourceGroupResource, string accountName, AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableNetAppResourceGroupResource(resourceGroupResource).GetNetAppSubscriptionQuotaItemAsync(accountName, location, quotaLimitName, cancellationToken).ConfigureAwait(false); + } + + /// Get the default and current quota limit. + /// The the method will execute against. + /// The accountName for the resource. + /// The name of the Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public static Response GetNetAppSubscriptionQuotaItem(this ResourceGroupResource resourceGroupResource, string accountName, AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableNetAppResourceGroupResource(resourceGroupResource).GetNetAppSubscriptionQuotaItem(accountName, location, quotaLimitName, cancellationToken); + } + + /// Gets a collection of ElasticAccounts in the . + /// The the method will execute against. + /// is null. + /// An object representing collection of ElasticAccounts and their operations over a ElasticAccountResource. + public static ElasticAccountCollection GetElasticAccounts(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableNetAppResourceGroupResource(resourceGroupResource).GetElasticAccounts(); + } + + /// Get the NetApp elastic account. + /// The the method will execute against. + /// The name of the ElasticAccount. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public static async Task> GetElasticAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableNetAppResourceGroupResource(resourceGroupResource).GetElasticAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } - /// - /// Gets a collection of NetAppAccountResources in the ResourceGroupResource. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Get the NetApp elastic account. + /// The the method will execute against. + /// The name of the ElasticAccount. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public static Response GetElasticAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableNetAppResourceGroupResource(resourceGroupResource).GetElasticAccount(accountName, cancellationToken); + } + + /// Gets a collection of ActiveDirectoryConfigs in the . + /// The the method will execute against. /// is null. - /// An object representing collection of NetAppAccountResources and their operations over a NetAppAccountResource. + /// An object representing collection of ActiveDirectoryConfigs and their operations over a ActiveDirectoryConfigResource. + public static ActiveDirectoryConfigCollection GetActiveDirectoryConfigs(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableNetAppResourceGroupResource(resourceGroupResource).GetActiveDirectoryConfigs(); + } + + /// Get the details of the specified active directory configuration. + /// The the method will execute against. + /// The name of the NetAppAccount. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public static async Task> GetActiveDirectoryConfigAsync(this ResourceGroupResource resourceGroupResource, string activeDirectoryConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableNetAppResourceGroupResource(resourceGroupResource).GetActiveDirectoryConfigAsync(activeDirectoryConfigName, cancellationToken).ConfigureAwait(false); + } + + /// Get the details of the specified active directory configuration. + /// The the method will execute against. + /// The name of the NetAppAccount. + /// The cancellation token to use. + /// is null. + [ForwardsClientCalls] + public static Response GetActiveDirectoryConfig(this ResourceGroupResource resourceGroupResource, string activeDirectoryConfigName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableNetAppResourceGroupResource(resourceGroupResource).GetActiveDirectoryConfig(activeDirectoryConfigName, cancellationToken); + } + + /// Gets a collection of NetAppAccounts in the . + /// The the method will execute against. + /// is null. + /// An object representing collection of NetAppAccounts and their operations over a NetAppAccountResource. public static NetAppAccountCollection GetNetAppAccounts(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -297,36 +471,11 @@ public static NetAppAccountCollection GetNetAppAccounts(this ResourceGroupResour return GetMockableNetAppResourceGroupResource(resourceGroupResource).GetNetAppAccounts(); } - /// - /// Get the NetApp account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Get the NetApp account. + /// The the method will execute against. /// The name of the NetApp account. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] public static async Task> GetNetAppAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { @@ -335,36 +484,11 @@ public static async Task> GetNetAppAccountAsync( return await GetMockableNetAppResourceGroupResource(resourceGroupResource).GetNetAppAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } - /// - /// Get the NetApp account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Get the NetApp account. + /// The the method will execute against. /// The name of the NetApp account. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] public static Response GetNetAppAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { @@ -373,832 +497,343 @@ public static Response GetNetAppAccount(this ResourceGrou return GetMockableNetAppResourceGroupResource(resourceGroupResource).GetNetAppAccount(accountName, cancellationToken); } - /// - /// Gets a collection of RegionInfoResources in the SubscriptionResource. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. + /// Gets an object representing a along with the instance operations that can be performed on it in the . + /// The the method will execute against. /// is null. - /// An object representing collection of RegionInfoResources and their operations over a RegionInfoResource. - public static RegionInfoResourceCollection GetRegionInfoResources(this SubscriptionResource subscriptionResource, AzureLocation location) + /// Returns a object. + public static RegionInfoResource GetRegionInfoResource(this SubscriptionResource subscriptionResource) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).GetRegionInfoResources(location); - } - - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetRegionInfoResource(); + } + + /// Get the default and current limits for quotas. + /// The the method will execute against. /// The name of the Azure region. /// The cancellation token to use. /// is null. - [ForwardsClientCalls] - public static async Task> GetRegionInfoResourceAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetNetAppSubscriptionQuotaItemsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableNetAppSubscriptionResource(subscriptionResource).GetRegionInfoResourceAsync(location, cancellationToken).ConfigureAwait(false); - } - - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppSubscriptionQuotaItemsAsync(location, cancellationToken); + } + + /// Get the default and current limits for quotas. + /// The the method will execute against. /// The name of the Azure region. /// The cancellation token to use. /// is null. - [ForwardsClientCalls] - public static Response GetRegionInfoResource(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetNetAppSubscriptionQuotaItems(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).GetRegionInfoResource(location, cancellationToken); - } - - /// - /// Check if a resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckNameAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// Name availability request. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppSubscriptionQuotaItems(location, cancellationToken); + } + + /// List and describe all NetApp elastic accounts in the subscription. + /// The the method will execute against. /// The cancellation token to use. - /// or is null. - public static async Task> CheckNetAppNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetElasticAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); - } - - /// - /// Check if a resource name is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckNameAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// Name availability request. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetElasticAccountsAsync(cancellationToken); + } + + /// List and describe all NetApp elastic accounts in the subscription. + /// The the method will execute against. /// The cancellation token to use. - /// or is null. - public static Response CheckNetAppNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetElasticAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppNameAvailability(location, content, cancellationToken); - } - - /// - /// Check if a file path is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckFilePathAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// File path availability request. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetElasticAccounts(cancellationToken); + } + + /// List all active directory configurations within the subscription. + /// The the method will execute against. /// The cancellation token to use. - /// or is null. - public static async Task> CheckNetAppFilePathAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetActiveDirectoryConfigsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppFilePathAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); - } - - /// - /// Check if a file path is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckFilePathAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// File path availability request. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetActiveDirectoryConfigsAsync(cancellationToken); + } + + /// List all active directory configurations within the subscription. + /// The the method will execute against. /// The cancellation token to use. - /// or is null. - public static Response CheckNetAppFilePathAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetActiveDirectoryConfigs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppFilePathAvailability(location, content, cancellationToken); - } - - /// - /// Check if a quota is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckQuotaAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// Quota availability request. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetActiveDirectoryConfigs(cancellationToken); + } + + /// List and describe all NetApp accounts in the subscription. + /// The the method will execute against. /// The cancellation token to use. - /// or is null. - public static async Task> CheckNetAppQuotaAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetNetAppAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppQuotaAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); - } - - /// - /// Check if a quota is available. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability - /// - /// - /// Operation Id - /// NetAppResource_CheckQuotaAvailability - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// Quota availability request. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppAccountsAsync(cancellationToken); + } + + /// List and describe all NetApp accounts in the subscription. + /// The the method will execute against. /// The cancellation token to use. - /// or is null. - public static Response CheckNetAppQuotaAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetNetAppAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNetAppQuotaAvailability(location, content, cancellationToken); - } - - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo - /// - /// - /// Operation Id - /// NetAppResource_QueryRegionInfo - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppAccounts(cancellationToken); + } + + /// Check if a resource name is available. + /// The the method will execute against. + /// The location name. + /// The request body. /// The cancellation token to use. /// is null. - public static async Task> QueryRegionInfoNetAppResourceAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + public static async Task> CheckNameAvailabilityAsync(this SubscriptionResource subscriptionResource, string location, ResourceNameAvailabilityRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableNetAppSubscriptionResource(subscriptionResource).QueryRegionInfoNetAppResourceAsync(location, cancellationToken).ConfigureAwait(false); - } - - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo - /// - /// - /// Operation Id - /// NetAppResource_QueryRegionInfo - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. + return await GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + } + + /// Check if a resource name is available. + /// The the method will execute against. + /// The location name. + /// The request body. /// The cancellation token to use. /// is null. - public static Response QueryRegionInfoNetAppResource(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + public static Response CheckNameAvailability(this SubscriptionResource subscriptionResource, string location, ResourceNameAvailabilityRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).QueryRegionInfoNetAppResource(location, cancellationToken); - } - - /// - /// Get details of the specified network sibling set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/queryNetworkSiblingSet - /// - /// - /// Operation Id - /// NetAppResource_QueryNetworkSiblingSet - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// Network sibling set to query. + return GetMockableNetAppSubscriptionResource(subscriptionResource).CheckNameAvailability(location, content, cancellationToken); + } + + /// Check if a file path is available. + /// The the method will execute against. + /// The location name. + /// The request body. /// The cancellation token to use. - /// or is null. - public static async Task> QueryNetworkSiblingSetNetAppResourceAsync(this SubscriptionResource subscriptionResource, AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + /// is null. + public static async Task> CheckFilePathAvailabilityAsync(this SubscriptionResource subscriptionResource, string location, FilePathAvailabilityRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableNetAppSubscriptionResource(subscriptionResource).QueryNetworkSiblingSetNetAppResourceAsync(location, content, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get details of the specified network sibling set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/queryNetworkSiblingSet - /// - /// - /// Operation Id - /// NetAppResource_QueryNetworkSiblingSet - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// Network sibling set to query. + return await GetMockableNetAppSubscriptionResource(subscriptionResource).CheckFilePathAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + } + + /// Check if a file path is available. + /// The the method will execute against. + /// The location name. + /// The request body. /// The cancellation token to use. - /// or is null. - public static Response QueryNetworkSiblingSetNetAppResource(this SubscriptionResource subscriptionResource, AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + /// is null. + public static Response CheckFilePathAvailability(this SubscriptionResource subscriptionResource, string location, FilePathAvailabilityRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).QueryNetworkSiblingSetNetAppResource(location, content, cancellationToken); - } - - /// - /// Update the network features of the specified network sibling set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/updateNetworkSiblingSet - /// - /// - /// Operation Id - /// NetAppResource_UpdateNetworkSiblingSet - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the Azure region. - /// Update for the specified network sibling set. + return GetMockableNetAppSubscriptionResource(subscriptionResource).CheckFilePathAvailability(location, content, cancellationToken); + } + + /// Check if a quota is available. + /// The the method will execute against. + /// The location name. + /// The request body. /// The cancellation token to use. - /// or is null. - public static async Task> UpdateNetworkSiblingSetNetAppResourceAsync(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + /// is null. + public static async Task> CheckQuotaAvailabilityAsync(this SubscriptionResource subscriptionResource, string location, QuotaAvailabilityRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableNetAppSubscriptionResource(subscriptionResource).UpdateNetworkSiblingSetNetAppResourceAsync(waitUntil, location, content, cancellationToken).ConfigureAwait(false); - } - - /// - /// Update the network features of the specified network sibling set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/updateNetworkSiblingSet - /// - /// - /// Operation Id - /// NetAppResource_UpdateNetworkSiblingSet - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the Azure region. - /// Update for the specified network sibling set. + return await GetMockableNetAppSubscriptionResource(subscriptionResource).CheckQuotaAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + } + + /// Check if a quota is available. + /// The the method will execute against. + /// The location name. + /// The request body. /// The cancellation token to use. - /// or is null. - public static ArmOperation UpdateNetworkSiblingSetNetAppResource(this SubscriptionResource subscriptionResource, WaitUntil waitUntil, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) + /// is null. + public static Response CheckQuotaAvailability(this SubscriptionResource subscriptionResource, string location, QuotaAvailabilityRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).UpdateNetworkSiblingSetNetAppResource(waitUntil, location, content, cancellationToken); - } - - /// - /// Get current subscription usages - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/usages - /// - /// - /// Operation Id - /// NetAppResourceUsages_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. + return GetMockableNetAppSubscriptionResource(subscriptionResource).CheckQuotaAvailability(location, content, cancellationToken); + } + + /// Provides storage to network proximity and logical zone mapping information. + /// The the method will execute against. + /// The location name. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetNetAppResourceUsagesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + public static async Task> QueryRegionInfoAsync(this SubscriptionResource subscriptionResource, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppResourceUsagesAsync(location, cancellationToken); - } - - /// - /// Get current subscription usages - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/usages - /// - /// - /// Operation Id - /// NetAppResourceUsages_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. + return await GetMockableNetAppSubscriptionResource(subscriptionResource).QueryRegionInfoAsync(location, cancellationToken).ConfigureAwait(false); + } + + /// Provides storage to network proximity and logical zone mapping information. + /// The the method will execute against. + /// The location name. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetNetAppResourceUsages(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + public static Response QueryRegionInfo(this SubscriptionResource subscriptionResource, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppResourceUsages(location, cancellationToken); - } - - /// - /// Get current subscription usage of the specific type - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/usages/{usageType} - /// - /// - /// Operation Id - /// NetAppResourceUsages_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// The type of usage. + return GetMockableNetAppSubscriptionResource(subscriptionResource).QueryRegionInfo(location, cancellationToken); + } + + /// Get details of the specified network sibling set. + /// The the method will execute against. + /// The location name. + /// The request body. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public static async Task> GetNetAppResourceUsageAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string usageType, CancellationToken cancellationToken = default) + /// is null. + public static async Task> QueryNetworkSiblingSetAsync(this SubscriptionResource subscriptionResource, string location, QueryNetworkSiblingSetRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppResourceUsageAsync(location, usageType, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get current subscription usage of the specific type - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/usages/{usageType} - /// - /// - /// Operation Id - /// NetAppResourceUsages_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// The type of usage. + return await GetMockableNetAppSubscriptionResource(subscriptionResource).QueryNetworkSiblingSetAsync(location, content, cancellationToken).ConfigureAwait(false); + } + + /// Get details of the specified network sibling set. + /// The the method will execute against. + /// The location name. + /// The request body. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public static Response GetNetAppResourceUsage(this SubscriptionResource subscriptionResource, AzureLocation location, string usageType, CancellationToken cancellationToken = default) + /// is null. + public static Response QueryNetworkSiblingSet(this SubscriptionResource subscriptionResource, string location, QueryNetworkSiblingSetRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppResourceUsage(location, usageType, cancellationToken); - } - - /// - /// Get the default and current limits for quotas - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimits_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. + return GetMockableNetAppSubscriptionResource(subscriptionResource).QueryNetworkSiblingSet(location, content, cancellationToken); + } + + /// Update the network features of the specified network sibling set. + /// The the method will execute against. + /// The location name. + /// The request body. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetNetAppQuotaLimitsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + public static async Task> UpdateNetworkSiblingSetAsync(this SubscriptionResource subscriptionResource, string location, UpdateNetworkSiblingSetRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppQuotaLimitsAsync(location, cancellationToken); - } - - /// - /// Get the default and current limits for quotas - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimits_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. + return await GetMockableNetAppSubscriptionResource(subscriptionResource).UpdateNetworkSiblingSetAsync(location, content, cancellationToken).ConfigureAwait(false); + } + + /// Update the network features of the specified network sibling set. + /// The the method will execute against. + /// The location name. + /// The request body. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetNetAppQuotaLimits(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + public static Response UpdateNetworkSiblingSet(this SubscriptionResource subscriptionResource, string location, UpdateNetworkSiblingSetRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppQuotaLimits(location, cancellationToken); - } - - /// - /// Get the default and current subscription quota limit - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName} - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimits_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// The name of the Quota Limit. + return GetMockableNetAppSubscriptionResource(subscriptionResource).UpdateNetworkSiblingSet(location, content, cancellationToken); + } + + /// Get current subscription usages. + /// The the method will execute against. + /// The location name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public static async Task> GetNetAppQuotaLimitAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetAllAsync(this SubscriptionResource subscriptionResource, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppQuotaLimitAsync(location, quotaLimitName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the default and current subscription quota limit - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName} - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimits_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// The name of the Quota Limit. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetAllAsync(location, cancellationToken); + } + + /// Get current subscription usages. + /// The the method will execute against. + /// The location name. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public static Response GetNetAppQuotaLimit(this SubscriptionResource subscriptionResource, AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetAll(this SubscriptionResource subscriptionResource, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppQuotaLimit(location, quotaLimitName, cancellationToken); - } - - /// - /// List and describe all NetApp accounts in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + return GetMockableNetAppSubscriptionResource(subscriptionResource).GetAll(location, cancellationToken); + } + + /// Get current subscription usage of the specific type. + /// The the method will execute against. + /// The name of the Azure region. + /// The type of usage. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetNetAppAccountsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + public static async Task> GetAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string usageType, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppAccountsAsync(cancellationToken); + return await GetMockableNetAppSubscriptionResource(subscriptionResource).GetAsync(location, usageType, cancellationToken).ConfigureAwait(false); } - /// - /// List and describe all NetApp accounts in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts - /// - /// - /// Operation Id - /// Accounts_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Get current subscription usage of the specific type. + /// The the method will execute against. + /// The name of the Azure region. + /// The type of usage. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetNetAppAccounts(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + public static Response Get(this SubscriptionResource subscriptionResource, AzureLocation location, string usageType, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableNetAppSubscriptionResource(subscriptionResource).GetNetAppAccounts(cancellationToken); + return GetMockableNetAppSubscriptionResource(subscriptionResource).Get(location, usageType, cancellationToken); + } + + /// List the operations for the provider. + /// The the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetAllAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableNetAppTenantResource(tenantResource).GetAllAsync(cancellationToken); + } + + /// List the operations for the provider. + /// The the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetAll(this TenantResource tenantResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableNetAppTenantResource(tenantResource).GetAll(cancellationToken); } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Argument.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Argument.cs index 6ecd3befeb6a..bce975131f55 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Argument.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Argument.cs @@ -11,8 +11,10 @@ namespace Azure.ResourceManager.NetApp { - internal static class Argument + internal static partial class Argument { + /// The value. + /// The name. public static void AssertNotNull(T value, string name) { if (value is null) @@ -21,8 +23,10 @@ public static void AssertNotNull(T value, string name) } } + /// The value. + /// The name. public static void AssertNotNull(T? value, string name) - where T : struct + where T : struct { if (!value.HasValue) { @@ -30,6 +34,8 @@ public static void AssertNotNull(T? value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(IEnumerable value, string name) { if (value is null) @@ -51,6 +57,8 @@ public static void AssertNotNullOrEmpty(IEnumerable value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(string value, string name) { if (value is null) @@ -62,68 +70,5 @@ public static void AssertNotNullOrEmpty(string value, string name) throw new ArgumentException("Value cannot be an empty string.", name); } } - - public static void AssertNotNullOrWhiteSpace(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (string.IsNullOrWhiteSpace(value)) - { - throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); - } - } - - public static void AssertNotDefault(ref T value, string name) - where T : struct, IEquatable - { - if (value.Equals(default)) - { - throw new ArgumentException("Value cannot be empty.", name); - } - } - - public static void AssertInRange(T value, T minimum, T maximum, string name) - where T : notnull, IComparable - { - if (minimum.CompareTo(value) > 0) - { - throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); - } - if (maximum.CompareTo(value) < 0) - { - throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); - } - } - - public static void AssertEnumDefined(Type enumType, object value, string name) - { - if (!Enum.IsDefined(enumType, value)) - { - throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); - } - } - - public static T CheckNotNull(T value, string name) - where T : class - { - AssertNotNull(value, name); - return value; - } - - public static string CheckNotNullOrEmpty(string value, string name) - { - AssertNotNullOrEmpty(value, name); - return value; - } - - public static void AssertNull(T value, string name, string message = null) - { - if (value != null) - { - throw new ArgumentException(message ?? "Value must be null.", name); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/AsyncPageableWrapper.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/AsyncPageableWrapper.cs new file mode 100644 index 000000000000..c3763993b467 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/AsyncPageableWrapper.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class AsyncPageableWrapper : AsyncPageable + { + /// The source async pageable value of type AsyncPageable<T>. + private AsyncPageable _source; + /// The converter function from T to U. + private Func _converter; + + /// Initializes a new instance of the AsyncPageableWrapper class. + /// The source async pageable value of type AsyncPageable<T>. + /// The converter function from T to U. + public AsyncPageableWrapper(AsyncPageable source, Func converter) + { + _source = source; + _converter = converter; + } + + /// Converts the pages from AsyncPageable to Page. + /// A continuation token from a previous response. + /// An optional hint to specify the desired size of each page. + /// An enumerable of pages containing converted items of type U. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + await foreach (Page page in _source.AsPages(continuationToken, pageSizeHint).ConfigureAwait(false)) + { + List convertedItems = new List(); + foreach (T item in page.Values) + { + convertedItems.Add(_converter.Invoke(item)); + } + yield return Page.FromValues(convertedItems, page.ContinuationToken, page.GetRawResponse()); + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ChangeTrackingDictionary.cs index 4dc2b517682f..670427f683dd 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -11,7 +11,8 @@ namespace Azure.ResourceManager.NetApp { - internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary + where TKey : notnull { private IDictionary _innerDictionary; @@ -19,6 +20,7 @@ public ChangeTrackingDictionary() { } + /// The inner dictionary. public ChangeTrackingDictionary(IDictionary dictionary) { if (dictionary == null) @@ -28,6 +30,7 @@ public ChangeTrackingDictionary(IDictionary dictionary) _innerDictionary = new Dictionary(dictionary); } + /// The inner dictionary. public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) { if (dictionary == null) @@ -41,16 +44,22 @@ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerDictionary == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + /// Gets the Keys. public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + /// Gets the Values. public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + /// Gets or sets the value associated with the specified key. public TValue this[TKey key] { get @@ -67,8 +76,10 @@ public TValue this[TKey key] } } + /// Gets the Keys. IEnumerable IReadOnlyDictionary.Keys => Keys; + /// Gets the Values. IEnumerable IReadOnlyDictionary.Values => Values; public IEnumerator> GetEnumerator() @@ -89,6 +100,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(KeyValuePair item) { EnsureDictionary().Add(item); @@ -99,6 +111,7 @@ public void Clear() EnsureDictionary().Clear(); } + /// The item to search for. public bool Contains(KeyValuePair item) { if (IsUndefined) @@ -108,6 +121,8 @@ public bool Contains(KeyValuePair item) return EnsureDictionary().Contains(item); } + /// The array to copy. + /// The index. public void CopyTo(KeyValuePair[] array, int index) { if (IsUndefined) @@ -117,6 +132,7 @@ public void CopyTo(KeyValuePair[] array, int index) EnsureDictionary().CopyTo(array, index); } + /// The item to remove. public bool Remove(KeyValuePair item) { if (IsUndefined) @@ -126,11 +142,14 @@ public bool Remove(KeyValuePair item) return EnsureDictionary().Remove(item); } + /// The key. + /// The value to add. public void Add(TKey key, TValue value) { EnsureDictionary().Add(key, value); } + /// The key to search for. public bool ContainsKey(TKey key) { if (IsUndefined) @@ -140,6 +159,7 @@ public bool ContainsKey(TKey key) return EnsureDictionary().ContainsKey(key); } + /// The key. public bool Remove(TKey key) { if (IsUndefined) @@ -149,6 +169,8 @@ public bool Remove(TKey key) return EnsureDictionary().Remove(key); } + /// The key to search for. + /// The value. public bool TryGetValue(TKey key, out TValue value) { if (IsUndefined) diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ChangeTrackingList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ChangeTrackingList.cs index 38eec69e9967..0f69a12b1d4c 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ChangeTrackingList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ChangeTrackingList.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.NetApp { - internal class ChangeTrackingList : IList, IReadOnlyList + internal partial class ChangeTrackingList : IList, IReadOnlyList { private IList _innerList; @@ -20,6 +20,7 @@ public ChangeTrackingList() { } + /// The inner list. public ChangeTrackingList(IList innerList) { if (innerList != null) @@ -28,6 +29,7 @@ public ChangeTrackingList(IList innerList) } } + /// The inner list. public ChangeTrackingList(IReadOnlyList innerList) { if (innerList != null) @@ -36,12 +38,16 @@ public ChangeTrackingList(IReadOnlyList innerList) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerList == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureList().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + /// Gets or sets the value associated with the specified key. public T this[int index] { get @@ -85,6 +91,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(T item) { EnsureList().Add(item); @@ -95,6 +102,7 @@ public void Clear() EnsureList().Clear(); } + /// The item. public bool Contains(T item) { if (IsUndefined) @@ -104,6 +112,8 @@ public bool Contains(T item) return EnsureList().Contains(item); } + /// The array to copy to. + /// The array index. public void CopyTo(T[] array, int arrayIndex) { if (IsUndefined) @@ -113,6 +123,7 @@ public void CopyTo(T[] array, int arrayIndex) EnsureList().CopyTo(array, arrayIndex); } + /// The item. public bool Remove(T item) { if (IsUndefined) @@ -122,6 +133,7 @@ public bool Remove(T item) return EnsureList().Remove(item); } + /// The item. public int IndexOf(T item) { if (IsUndefined) @@ -131,11 +143,14 @@ public int IndexOf(T item) return EnsureList().IndexOf(item); } + /// The inner list. + /// The item. public void Insert(int index, T item) { EnsureList().Insert(index, item); } + /// The inner list. public void RemoveAt(int index) { if (IsUndefined) diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..47d9792d5dea --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + await pipeline.SendAsync(message, userCancellationToken).ConfigureAwait(false); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static Response ProcessMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + pipeline.Send(message, userCancellationToken); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = await pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + + public static Response ProcessHeadAsBoolMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = pipeline.ProcessMessage(message, context); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..c61062a783a0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.NetApp +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..7b05610b3978 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.NetApp +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string propertySerializationName) + { + PropertyName = propertyName; + PropertySerializationName = propertySerializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string PropertySerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..2c4e95ecfbbf --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.NetApp +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..b214d3d96339 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.NetApp +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ErrorResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..4fb042c90647 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ErrorResult : Response + { + private readonly Response _response; + private readonly RequestFailedException _exception; + + public ErrorResult(Response response, RequestFailedException exception) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + + /// + public override Response GetRawResponse() + { + return _response; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ModelSerializationExtensions.cs index 5735e30d692e..6577cd48fc4a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/ModelSerializationExtensions.cs @@ -11,18 +11,16 @@ using System.Diagnostics; using System.Globalization; using System.Text.Json; -using System.Xml; -using Azure.Core; namespace Azure.ResourceManager.NetApp { - internal static class ModelSerializationExtensions + internal static partial class ModelSerializationExtensions { - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly ModelReaderWriterOptions WireV3Options = new ModelReaderWriterOptions("W|v3"); - internal static readonly ModelReaderWriterOptions JsonV3Options = new ModelReaderWriterOptions("J|v3"); - internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; public static object GetObject(this JsonElement element) { @@ -48,14 +46,14 @@ public static object GetObject(this JsonElement element) case JsonValueKind.Null: return null; case JsonValueKind.Object: - var dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var jsonProperty in element.EnumerateObject()) { dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); } return dictionary; case JsonValueKind.Array: - var list = new List(); + List list = new List(); foreach (var item in element.EnumerateArray()) { list.Add(item.GetObject()); @@ -93,7 +91,7 @@ public static char GetChar(this JsonElement element) { if (element.ValueKind == JsonValueKind.String) { - var text = element.GetString(); + string text = element.GetString(); if (text == null || text.Length != 1) { throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); @@ -107,14 +105,14 @@ public static char GetChar(this JsonElement element) } [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) { - throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); } public static string GetRequiredString(this JsonElement element) { - var value = element.GetString(); + string value = element.GetString(); if (value == null) { throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); @@ -181,9 +179,6 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, T value, Mode case IJsonModel jsonModel: jsonModel.Write(writer, options ?? WireOptions); break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; case byte[] bytes: writer.WriteBase64StringValue(bytes); break; @@ -259,151 +254,5 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo { writer.WriteObjectValue(value, options); } - - internal static bool IsSentinelValue(BinaryData value) - { - ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; - ReadOnlySpan valueSpan = value.ToMemory().Span; - return sentinelSpan.SequenceEqual(valueSpan); - } - - internal static class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; - int size = checked(numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Optional.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Optional.cs index 06aaf7812653..1a140ad73a0a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Optional.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Optional.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.NetApp { - internal static class Optional + internal static partial class Optional { public static bool IsCollectionDefined(IEnumerable collection) { @@ -28,7 +28,7 @@ public static bool IsCollectionDefined(IReadOnlyDictionary(T? value) - where T : struct + where T : struct { return value.HasValue; } @@ -38,14 +38,14 @@ public static bool IsDefined(object value) return value != null; } - public static bool IsDefined(JsonElement value) + public static bool IsDefined(string value) { - return value.ValueKind != JsonValueKind.Undefined; + return value != null; } - public static bool IsDefined(string value) + public static bool IsDefined(JsonElement value) { - return value != null; + return value.ValueKind != JsonValueKind.Undefined; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/PageableWrapper.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/PageableWrapper.cs new file mode 100644 index 000000000000..044a6d06a15f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/PageableWrapper.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class PageableWrapper : Pageable + { + /// The source pageable value of type Pageable<T>. + private Pageable _source; + /// The converter function from T to U. + private Func _converter; + + /// Initializes a new instance of the PageableWrapper class. + /// The source pageable value of type Pageable<T>. + /// The converter function from T to U. + public PageableWrapper(Pageable source, Func converter) + { + _source = source; + _converter = converter; + } + + /// Converts the pages from Pageable to Page. + /// A continuation token from a previous response. + /// An optional hint to specify the desired size of each page. + /// An enumerable of pages containing converted items of type U. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + foreach (Page page in _source.AsPages(continuationToken, pageSizeHint)) + { + List convertedItems = new List(); + foreach (T item in page.Values) + { + convertedItems.Add(_converter.Invoke(item)); + } + yield return Page.FromValues(convertedItems, page.ContinuationToken, page.GetRawResponse()); + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/RawRequestUriBuilderExtensions.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/RawRequestUriBuilderExtensions.cs new file mode 100644 index 000000000000..610b876730e6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/RawRequestUriBuilderExtensions.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp +{ + internal static partial class RawRequestUriBuilderExtensions + { + public static void AppendQueryDelimited(this RawRequestUriBuilder builder, string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + builder.AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/RequestContextExtensions.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..7f0564d98464 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/RequestContextExtensions.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Azure; + +namespace Azure.ResourceManager.NetApp +{ + internal static partial class RequestContextExtensions + { + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + public static ValueTuple Parse(this RequestContext context) + { + if (context == null) + { + return (CancellationToken.None, ErrorOptions.Default); + } + return (context.CancellationToken, context.ErrorOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/SerializationFormat.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 000000000000..d6024ba9fc2a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/SerializationFormat.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.NetApp +{ + internal enum SerializationFormat + { + /// The default serialization format. + Default = 0, + /// The RFC1123 date time format. + DateTime_RFC1123 = 1, + /// The RFC3339 date time format. + DateTime_RFC3339 = 2, + /// The RFC7231 date time format. + DateTime_RFC7231 = 3, + /// The ISO8601 date time format. + DateTime_ISO8601 = 4, + /// The Unix date time format. + DateTime_Unix = 5, + /// The ISO8601 date format. + Date_ISO8601 = 6, + /// The ISO8601 duration format. + Duration_ISO8601 = 7, + /// The constant duration format. + Duration_Constant = 8, + /// The seconds duration format. + Duration_Seconds = 9, + /// The seconds duration format with float precision. + Duration_Seconds_Float = 10, + /// The seconds duration format with double precision. + Duration_Seconds_Double = 11, + /// The milliseconds duration format. + Duration_Milliseconds = 12, + /// The milliseconds duration format with float precision. + Duration_Milliseconds_Float = 13, + /// The milliseconds duration format with double precision. + Duration_Milliseconds_Double = 14, + /// The ISO8601 time format. + Time_ISO8601 = 15, + /// The Base64Url bytes format. + Bytes_Base64Url = 16, + /// The Base64 bytes format. + Bytes_Base64 = 17 + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/TypeFormatters.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..a6a12e999f32 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Xml; + +namespace Azure.ResourceManager.NetApp +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ToFormatSpecifier(SerializationFormat format) => format switch + { + SerializationFormat.DateTime_RFC1123 => "R", + SerializationFormat.DateTime_RFC3339 => "O", + SerializationFormat.DateTime_RFC7231 => "R", + SerializationFormat.DateTime_ISO8601 => "O", + SerializationFormat.Date_ISO8601 => "D", + SerializationFormat.DateTime_Unix => "U", + SerializationFormat.Bytes_Base64Url => "U", + SerializationFormat.Bytes_Base64 => "D", + SerializationFormat.Duration_ISO8601 => "P", + SerializationFormat.Duration_Constant => "c", + SerializationFormat.Duration_Seconds => "%s", + SerializationFormat.Duration_Seconds_Float => "s\\.FFF", + SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", + SerializationFormat.Time_ISO8601 => "T", + _ => null + }; + + public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) + { + string formatSpecifier = ToFormatSpecifier(format); + + return value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), + TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), + TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Utf8JsonRequestContent.cs index cd065bee929d..c7ba5ec94754 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.NetApp { - internal class Utf8JsonRequestContent : RequestContent + internal partial class Utf8JsonRequestContent : RequestContent { private readonly MemoryStream _stream; private readonly RequestContent _content; @@ -25,20 +25,26 @@ public Utf8JsonRequestContent() JsonWriter = new Utf8JsonWriter(_stream); } + /// Gets the JsonWriter. public Utf8JsonWriter JsonWriter { get; } + /// The stream containing the data to be written. + /// The cancellation token to use. public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) { await JsonWriter.FlushAsync().ConfigureAwait(false); await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); } + /// The stream containing the data to be written. + /// The cancellation token to use. public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) { JsonWriter.Flush(); _content.WriteTo(stream, cancellationToken); } + /// public override bool TryComputeLength(out long length) { length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ActiveDirectoryConfigOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ActiveDirectoryConfigOperationSource.cs new file mode 100644 index 000000000000..365ac48196f1 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ActiveDirectoryConfigOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ActiveDirectoryConfigOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal ActiveDirectoryConfigOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + ActiveDirectoryConfigResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ActiveDirectoryConfigData data = ActiveDirectoryConfigData.DeserializeActiveDirectoryConfigData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ActiveDirectoryConfigResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ActiveDirectoryConfigData data = ActiveDirectoryConfigData.DeserializeActiveDirectoryConfigData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ActiveDirectoryConfigResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupOperationSource.cs new file mode 100644 index 000000000000..630c0438b07f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class BackupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal BackupOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + BackupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + BackupData data = BackupData.DeserializeBackupData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new BackupResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + BackupData data = BackupData.DeserializeBackupData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new BackupResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupPolicyOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupPolicyOperationSource.cs new file mode 100644 index 000000000000..313120d07859 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupPolicyOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class BackupPolicyOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal BackupPolicyOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + BackupPolicyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + BackupPolicyData data = BackupPolicyData.DeserializeBackupPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new BackupPolicyResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + BackupPolicyData data = BackupPolicyData.DeserializeBackupPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new BackupPolicyResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupVaultOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupVaultOperationSource.cs new file mode 100644 index 000000000000..351abe68d802 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BackupVaultOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class BackupVaultOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal BackupVaultOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + BackupVaultResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + BackupVaultData data = BackupVaultData.DeserializeBackupVaultData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new BackupVaultResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + BackupVaultData data = BackupVaultData.DeserializeBackupVaultData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new BackupVaultResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BucketOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BucketOperationSource.cs new file mode 100644 index 000000000000..0365adb62408 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/BucketOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class BucketOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal BucketOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + BucketResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + BucketData data = BucketData.DeserializeBucketData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new BucketResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + BucketData data = BucketData.DeserializeBucketData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new BucketResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/CacheOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/CacheOperationSource.cs new file mode 100644 index 000000000000..7ee992614ba3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/CacheOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class CacheOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal CacheOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + CacheResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + CacheData data = CacheData.DeserializeCacheData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new CacheResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + CacheData data = CacheData.DeserializeCacheData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new CacheResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/CapacityPoolOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/CapacityPoolOperationSource.cs index e90ae60f6aad..84eccde18138 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/CapacityPoolOperationSource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/CapacityPoolOperationSource.cs @@ -5,32 +5,45 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; namespace Azure.ResourceManager.NetApp { - internal class CapacityPoolOperationSource : IOperationSource + /// + internal partial class CapacityPoolOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal CapacityPoolOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// CapacityPoolResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + CapacityPoolData data = CapacityPoolData.DeserializeCapacityPoolData(document.RootElement, ModelSerializationExtensions.WireOptions); return new CapacityPoolResource(_client, data); } + /// The response from the service. + /// The cancellation token to use. + /// async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new CapacityPoolResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + CapacityPoolData data = CapacityPoolData.DeserializeCapacityPoolData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new CapacityPoolResource(_client, data); } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ClusterPeerCommandResponseOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ClusterPeerCommandResponseOperationSource.cs new file mode 100644 index 000000000000..0a033fe55979 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ClusterPeerCommandResponseOperationSource.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ClusterPeerCommandResponseOperationSource : IOperationSource + { + /// + internal ClusterPeerCommandResponseOperationSource() + { + } + + /// The response from the service. + /// The cancellation token to use. + /// + ClusterPeerCommandResponse IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ClusterPeerCommandResponse result = ClusterPeerCommandResponse.DeserializeClusterPeerCommandResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ClusterPeerCommandResponse result = ClusterPeerCommandResponse.DeserializeClusterPeerCommandResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ClusterPeerCommandResultOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ClusterPeerCommandResultOperationSource.cs deleted file mode 100644 index a739f1989d86..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ClusterPeerCommandResultOperationSource.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - internal class ClusterPeerCommandResultOperationSource : IOperationSource - { - ClusterPeerCommandResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - return ClusterPeerCommandResult.DeserializeClusterPeerCommandResult(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - return ClusterPeerCommandResult.DeserializeClusterPeerCommandResult(document.RootElement); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticAccountOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticAccountOperationSource.cs new file mode 100644 index 000000000000..8c0697ecf554 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticAccountOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ElasticAccountOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal ElasticAccountOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + ElasticAccountResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ElasticAccountData data = ElasticAccountData.DeserializeElasticAccountData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticAccountResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ElasticAccountData data = ElasticAccountData.DeserializeElasticAccountData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticAccountResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupOperationSource.cs new file mode 100644 index 000000000000..b58e06ad0f70 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ElasticBackupOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal ElasticBackupOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + ElasticBackupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ElasticBackupData data = ElasticBackupData.DeserializeElasticBackupData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticBackupResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ElasticBackupData data = ElasticBackupData.DeserializeElasticBackupData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticBackupResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupPolicyOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupPolicyOperationSource.cs new file mode 100644 index 000000000000..6f7ee0cb76ef --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupPolicyOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ElasticBackupPolicyOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal ElasticBackupPolicyOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + ElasticBackupPolicyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ElasticBackupPolicyData data = ElasticBackupPolicyData.DeserializeElasticBackupPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticBackupPolicyResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ElasticBackupPolicyData data = ElasticBackupPolicyData.DeserializeElasticBackupPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticBackupPolicyResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupVaultOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupVaultOperationSource.cs new file mode 100644 index 000000000000..0cbf6086f2f4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticBackupVaultOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ElasticBackupVaultOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal ElasticBackupVaultOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + ElasticBackupVaultResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ElasticBackupVaultData data = ElasticBackupVaultData.DeserializeElasticBackupVaultData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticBackupVaultResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ElasticBackupVaultData data = ElasticBackupVaultData.DeserializeElasticBackupVaultData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticBackupVaultResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticCapacityPoolOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticCapacityPoolOperationSource.cs new file mode 100644 index 000000000000..d2575acf584d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticCapacityPoolOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ElasticCapacityPoolOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal ElasticCapacityPoolOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + ElasticCapacityPoolResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ElasticCapacityPoolData data = ElasticCapacityPoolData.DeserializeElasticCapacityPoolData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticCapacityPoolResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ElasticCapacityPoolData data = ElasticCapacityPoolData.DeserializeElasticCapacityPoolData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticCapacityPoolResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticSnapshotOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticSnapshotOperationSource.cs new file mode 100644 index 000000000000..db77270b2d74 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticSnapshotOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ElasticSnapshotOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal ElasticSnapshotOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + ElasticSnapshotResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ElasticSnapshotData data = ElasticSnapshotData.DeserializeElasticSnapshotData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticSnapshotResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ElasticSnapshotData data = ElasticSnapshotData.DeserializeElasticSnapshotData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticSnapshotResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticSnapshotPolicyOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticSnapshotPolicyOperationSource.cs new file mode 100644 index 000000000000..7f51cfaf6f63 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticSnapshotPolicyOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ElasticSnapshotPolicyOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal ElasticSnapshotPolicyOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + ElasticSnapshotPolicyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ElasticSnapshotPolicyData data = ElasticSnapshotPolicyData.DeserializeElasticSnapshotPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticSnapshotPolicyResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ElasticSnapshotPolicyData data = ElasticSnapshotPolicyData.DeserializeElasticSnapshotPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticSnapshotPolicyResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticVolumeOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticVolumeOperationSource.cs new file mode 100644 index 000000000000..9d78de2cb954 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ElasticVolumeOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ElasticVolumeOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal ElasticVolumeOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + ElasticVolumeResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ElasticVolumeData data = ElasticVolumeData.DeserializeElasticVolumeData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticVolumeResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ElasticVolumeData data = ElasticVolumeData.DeserializeElasticVolumeData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ElasticVolumeResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetGroupIdListForLdapUserResponseOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetGroupIdListForLdapUserResponseOperationSource.cs new file mode 100644 index 000000000000..651a0f84fda5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetGroupIdListForLdapUserResponseOperationSource.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class GetGroupIdListForLdapUserResponseOperationSource : IOperationSource + { + /// + internal GetGroupIdListForLdapUserResponseOperationSource() + { + } + + /// The response from the service. + /// The cancellation token to use. + /// + GetGroupIdListForLdapUserResponse IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + GetGroupIdListForLdapUserResponse result = GetGroupIdListForLdapUserResponse.DeserializeGetGroupIdListForLdapUserResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + GetGroupIdListForLdapUserResponse result = GetGroupIdListForLdapUserResponse.DeserializeGetGroupIdListForLdapUserResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetGroupIdListForLdapUserResultOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetGroupIdListForLdapUserResultOperationSource.cs deleted file mode 100644 index 23206bef8d73..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetGroupIdListForLdapUserResultOperationSource.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - internal class GetGroupIdListForLdapUserResultOperationSource : IOperationSource - { - GetGroupIdListForLdapUserResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - return GetGroupIdListForLdapUserResult.DeserializeGetGroupIdListForLdapUserResult(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - return GetGroupIdListForLdapUserResult.DeserializeGetGroupIdListForLdapUserResult(document.RootElement); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetKeyVaultStatusResponseOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetKeyVaultStatusResponseOperationSource.cs new file mode 100644 index 000000000000..97446654079d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/GetKeyVaultStatusResponseOperationSource.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class GetKeyVaultStatusResponseOperationSource : IOperationSource + { + /// + internal GetKeyVaultStatusResponseOperationSource() + { + } + + /// The response from the service. + /// The cancellation token to use. + /// + GetKeyVaultStatusResponse IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + GetKeyVaultStatusResponse result = GetKeyVaultStatusResponse.DeserializeGetKeyVaultStatusResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + GetKeyVaultStatusResponse result = GetKeyVaultStatusResponse.DeserializeGetKeyVaultStatusResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ListQuotaReportResponseOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ListQuotaReportResponseOperationSource.cs new file mode 100644 index 000000000000..f4170dc42eb4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/ListQuotaReportResponseOperationSource.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class ListQuotaReportResponseOperationSource : IOperationSource + { + /// + internal ListQuotaReportResponseOperationSource() + { + } + + /// The response from the service. + /// The cancellation token to use. + /// + ListQuotaReportResponse IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ListQuotaReportResponse result = ListQuotaReportResponse.DeserializeListQuotaReportResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ListQuotaReportResponse result = ListQuotaReportResponse.DeserializeListQuotaReportResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppAccountOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppAccountOperationSource.cs index 5dfca7f6977d..9734998eaaf8 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppAccountOperationSource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppAccountOperationSource.cs @@ -5,32 +5,45 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; namespace Azure.ResourceManager.NetApp { - internal class NetAppAccountOperationSource : IOperationSource + /// + internal partial class NetAppAccountOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal NetAppAccountOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// NetAppAccountResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + NetAppAccountData data = NetAppAccountData.DeserializeNetAppAccountData(document.RootElement, ModelSerializationExtensions.WireOptions); return new NetAppAccountResource(_client, data); } + /// The response from the service. + /// The cancellation token to use. + /// async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new NetAppAccountResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + NetAppAccountData data = NetAppAccountData.DeserializeNetAppAccountData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new NetAppAccountResource(_client, data); } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppArmOperation.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppArmOperation.cs index 721fac2c28df..a3b124ab2a07 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppArmOperation.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppArmOperation.cs @@ -6,18 +6,16 @@ #nullable disable using System; -using System.ClientModel.Primitives; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.NetApp { -#pragma warning disable SA1649 // File name should match first type name - internal class NetAppArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class NetAppArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected NetAppArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal NetAppArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response); @@ -36,12 +37,20 @@ internal NetAppArmOperation(Response response, RehydrationToken? rehydrationToke _operationId = GetOperationId(rehydrationToken); } + /// + /// The instance of . + /// The instance of . + /// The operation request. + /// The operation response. + /// The finalStateVia of the operation. + /// If should skip Api version override. + /// The Api version override value. internal NetAppArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); - if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + IOperation nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationImplementation) { - _nextLinkOperation = nextLinkOperationValue; + _nextLinkOperation = nextLinkOperationImplementation; _operationId = _nextLinkOperation.OperationId; } else @@ -49,48 +58,49 @@ internal NetAppArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pi _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "NetAppArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + nextLinkOperation, + clientDiagnostics, + response, + "NetAppArmOperation", + null, + new SequentialDelayStrategy()); } + /// Gets the Id. + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// Gets the HasCompleted. + public override bool HasCompleted => _operation.HasCompleted; + + /// The token to rehydrate a long-running operation. private string GetOperationId(RehydrationToken? rehydrationToken) { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - using var document = JsonDocument.Parse(data); - var lroDetails = document.RootElement; - return lroDetails.GetProperty("id").GetString(); + return rehydrationToken?.Id; } - /// - public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; - /// + /// public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// + /// public override Response GetRawResponse() => _operation.RawResponse; - /// + /// public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - /// + /// public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - /// + /// public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); - /// + /// public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); - /// + /// public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); - /// + /// public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppArmOperationOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppArmOperationOfT.cs index 7418b325ebb6..16ce51ebe26f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppArmOperationOfT.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppArmOperationOfT.cs @@ -6,18 +6,16 @@ #nullable disable using System; -using System.ClientModel.Primitives; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.NetApp { -#pragma warning disable SA1649 // File name should match first type name - internal class NetAppArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class NetAppArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected NetAppArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal NetAppArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); @@ -36,12 +37,21 @@ internal NetAppArmOperation(Response response, RehydrationToken? rehydrationT _operationId = GetOperationId(rehydrationToken); } + /// + /// The instance of . + /// The instance of . + /// The instance of . + /// The operation request. + /// The operation response. + /// The finalStateVia of the operation. + /// If should skip Api version override. + /// The Api version override value. internal NetAppArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); - if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + IOperation nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationImplementation) { - _nextLinkOperation = nextLinkOperationValue; + _nextLinkOperation = nextLinkOperationImplementation; _operationId = _nextLinkOperation.OperationId; } else @@ -49,54 +59,55 @@ internal NetAppArmOperation(IOperationSource source, ClientDiagnostics client _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "NetAppArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + NextLinkOperationImplementation.Create(source, nextLinkOperation), + clientDiagnostics, + response, + "NetAppArmOperation", + null, + new SequentialDelayStrategy()); } - private string GetOperationId(RehydrationToken? rehydrationToken) - { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - using var document = JsonDocument.Parse(data); - var lroDetails = document.RootElement; - return lroDetails.GetProperty("id").GetString(); - } - /// + /// Gets the Id. public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; - /// - public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; - - /// + /// Gets the Value. public override T Value => _operation.Value; - /// + /// Gets the HasValue. public override bool HasValue => _operation.HasValue; - /// + /// Gets the HasCompleted. public override bool HasCompleted => _operation.HasCompleted; - /// + /// The token to rehydrate a long-running operation. + private string GetOperationId(RehydrationToken? rehydrationToken) + { + return rehydrationToken?.Id; + } + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// public override Response GetRawResponse() => _operation.RawResponse; - /// + /// public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - /// + /// public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - /// + /// public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); - /// + /// public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); - /// + /// public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - /// + /// public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupPolicyOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupPolicyOperationSource.cs deleted file mode 100644 index eacef25750c2..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupPolicyOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppBackupPolicyOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal NetAppBackupPolicyOperationSource(ArmClient client) - { - _client = client; - } - - NetAppBackupPolicyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return new NetAppBackupPolicyResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new NetAppBackupPolicyResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupVaultBackupOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupVaultBackupOperationSource.cs deleted file mode 100644 index 1061f3fb9bd9..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupVaultBackupOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppBackupVaultBackupOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal NetAppBackupVaultBackupOperationSource(ArmClient client) - { - _client = client; - } - - NetAppBackupVaultBackupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return new NetAppBackupVaultBackupResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new NetAppBackupVaultBackupResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupVaultOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupVaultOperationSource.cs deleted file mode 100644 index fb2b380013f3..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBackupVaultOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppBackupVaultOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal NetAppBackupVaultOperationSource(ArmClient client) - { - _client = client; - } - - NetAppBackupVaultResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return new NetAppBackupVaultResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new NetAppBackupVaultResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBucketOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBucketOperationSource.cs deleted file mode 100644 index dc2bfb052210..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppBucketOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppBucketOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal NetAppBucketOperationSource(ArmClient client) - { - _client = client; - } - - NetAppBucketResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return new NetAppBucketResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new NetAppBucketResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppKeyVaultStatusResultOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppKeyVaultStatusResultOperationSource.cs deleted file mode 100644 index 84ea57bd6f3b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppKeyVaultStatusResultOperationSource.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppKeyVaultStatusResultOperationSource : IOperationSource - { - NetAppKeyVaultStatusResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - return NetAppKeyVaultStatusResult.DeserializeNetAppKeyVaultStatusResult(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - return NetAppKeyVaultStatusResult.DeserializeNetAppKeyVaultStatusResult(document.RootElement); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppSubvolumeInfoOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppSubvolumeInfoOperationSource.cs deleted file mode 100644 index f468c857cb19..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppSubvolumeInfoOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppSubvolumeInfoOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal NetAppSubvolumeInfoOperationSource(ArmClient client) - { - _client = client; - } - - NetAppSubvolumeInfoResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return new NetAppSubvolumeInfoResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new NetAppSubvolumeInfoResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppSubvolumeMetadataOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppSubvolumeMetadataOperationSource.cs deleted file mode 100644 index 6d078c2d0cb1..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppSubvolumeMetadataOperationSource.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppSubvolumeMetadataOperationSource : IOperationSource - { - NetAppSubvolumeMetadata IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - return NetAppSubvolumeMetadata.DeserializeNetAppSubvolumeMetadata(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - return NetAppSubvolumeMetadata.DeserializeNetAppSubvolumeMetadata(document.RootElement); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeGroupOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeGroupOperationSource.cs deleted file mode 100644 index 3785b3863665..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeGroupOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppVolumeGroupOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal NetAppVolumeGroupOperationSource(ArmClient client) - { - _client = client; - } - - NetAppVolumeGroupResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return new NetAppVolumeGroupResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new NetAppVolumeGroupResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeOperationSource.cs deleted file mode 100644 index 00180bf42f1e..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppVolumeOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal NetAppVolumeOperationSource(ArmClient client) - { - _client = client; - } - - NetAppVolumeResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return new NetAppVolumeResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new NetAppVolumeResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeQuotaReportListResultOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeQuotaReportListResultOperationSource.cs deleted file mode 100644 index c17d1f7a91f5..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeQuotaReportListResultOperationSource.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppVolumeQuotaReportListResultOperationSource : IOperationSource - { - NetAppVolumeQuotaReportListResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - return NetAppVolumeQuotaReportListResult.DeserializeNetAppVolumeQuotaReportListResult(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - return NetAppVolumeQuotaReportListResult.DeserializeNetAppVolumeQuotaReportListResult(document.RootElement); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeQuotaRuleOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeQuotaRuleOperationSource.cs deleted file mode 100644 index 3967ba5ef2b5..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeQuotaRuleOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppVolumeQuotaRuleOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal NetAppVolumeQuotaRuleOperationSource(ArmClient client) - { - _client = client; - } - - NetAppVolumeQuotaRuleResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return new NetAppVolumeQuotaRuleResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new NetAppVolumeQuotaRuleResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeSnapshotOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeSnapshotOperationSource.cs deleted file mode 100644 index c4f411e7da6d..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetAppVolumeSnapshotOperationSource.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetAppVolumeSnapshotOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal NetAppVolumeSnapshotOperationSource(ArmClient client) - { - _client = client; - } - - NetAppVolumeSnapshotResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return new NetAppVolumeSnapshotResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new NetAppVolumeSnapshotResource(_client, data)).ConfigureAwait(false); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetworkSiblingSetOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetworkSiblingSetOperationSource.cs deleted file mode 100644 index 43e1d66df9b2..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/NetworkSiblingSetOperationSource.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - internal class NetworkSiblingSetOperationSource : IOperationSource - { - NetworkSiblingSet IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - return NetworkSiblingSet.DeserializeNetworkSiblingSet(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - return NetworkSiblingSet.DeserializeNetworkSiblingSet(document.RootElement); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SnapshotOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SnapshotOperationSource.cs new file mode 100644 index 000000000000..1fd11428050b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SnapshotOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class SnapshotOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal SnapshotOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + SnapshotResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + SnapshotData data = SnapshotData.DeserializeSnapshotData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new SnapshotResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + SnapshotData data = SnapshotData.DeserializeSnapshotData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new SnapshotResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SnapshotPolicyOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SnapshotPolicyOperationSource.cs index 0e96cc3f1a44..6b79ae9409b2 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SnapshotPolicyOperationSource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SnapshotPolicyOperationSource.cs @@ -5,32 +5,45 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; namespace Azure.ResourceManager.NetApp { - internal class SnapshotPolicyOperationSource : IOperationSource + /// + internal partial class SnapshotPolicyOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal SnapshotPolicyOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// SnapshotPolicyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + SnapshotPolicyData data = SnapshotPolicyData.DeserializeSnapshotPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); return new SnapshotPolicyResource(_client, data); } + /// The response from the service. + /// The cancellation token to use. + /// async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerNetAppContext.Default); - return await Task.FromResult(new SnapshotPolicyResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + SnapshotPolicyData data = SnapshotPolicyData.DeserializeSnapshotPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new SnapshotPolicyResource(_client, data); } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SubvolumeInfoOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SubvolumeInfoOperationSource.cs new file mode 100644 index 000000000000..1da7a3640cb3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SubvolumeInfoOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class SubvolumeInfoOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal SubvolumeInfoOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + SubvolumeInfoResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + SubvolumeInfoData data = SubvolumeInfoData.DeserializeSubvolumeInfoData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new SubvolumeInfoResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + SubvolumeInfoData data = SubvolumeInfoData.DeserializeSubvolumeInfoData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new SubvolumeInfoResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SubvolumeModelOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SubvolumeModelOperationSource.cs new file mode 100644 index 000000000000..a665cdd1a31e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SubvolumeModelOperationSource.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class SubvolumeModelOperationSource : IOperationSource + { + /// + internal SubvolumeModelOperationSource() + { + } + + /// The response from the service. + /// The cancellation token to use. + /// + SubvolumeModel IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + SubvolumeModel result = SubvolumeModel.DeserializeSubvolumeModel(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + SubvolumeModel result = SubvolumeModel.DeserializeSubvolumeModel(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SvmPeerCommandResponseOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SvmPeerCommandResponseOperationSource.cs new file mode 100644 index 000000000000..a3ed9e31720c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SvmPeerCommandResponseOperationSource.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class SvmPeerCommandResponseOperationSource : IOperationSource + { + /// + internal SvmPeerCommandResponseOperationSource() + { + } + + /// The response from the service. + /// The cancellation token to use. + /// + SvmPeerCommandResponse IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + SvmPeerCommandResponse result = SvmPeerCommandResponse.DeserializeSvmPeerCommandResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + SvmPeerCommandResponse result = SvmPeerCommandResponse.DeserializeSvmPeerCommandResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + return result; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SvmPeerCommandResultOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SvmPeerCommandResultOperationSource.cs deleted file mode 100644 index bbf416c77404..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/SvmPeerCommandResultOperationSource.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - internal class SvmPeerCommandResultOperationSource : IOperationSource - { - SvmPeerCommandResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - return SvmPeerCommandResult.DeserializeSvmPeerCommandResult(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - return SvmPeerCommandResult.DeserializeSvmPeerCommandResult(document.RootElement); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeGroupDetailsOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeGroupDetailsOperationSource.cs new file mode 100644 index 000000000000..1f57f1967a22 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeGroupDetailsOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class VolumeGroupDetailsOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal VolumeGroupDetailsOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + VolumeGroupDetailsResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + VolumeGroupDetailsData data = VolumeGroupDetailsData.DeserializeVolumeGroupDetailsData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new VolumeGroupDetailsResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + VolumeGroupDetailsData data = VolumeGroupDetailsData.DeserializeVolumeGroupDetailsData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new VolumeGroupDetailsResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeOperationSource.cs new file mode 100644 index 000000000000..1e4a5d9f36c5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class VolumeOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal VolumeOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + VolumeResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + VolumeData data = VolumeData.DeserializeVolumeData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new VolumeResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + VolumeData data = VolumeData.DeserializeVolumeData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new VolumeResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeQuotaRuleOperationSource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeQuotaRuleOperationSource.cs new file mode 100644 index 000000000000..57ee2c4fe327 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/LongRunningOperation/VolumeQuotaRuleOperationSource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + internal partial class VolumeQuotaRuleOperationSource : IOperationSource + { + private readonly ArmClient _client; + + /// + /// + internal VolumeQuotaRuleOperationSource(ArmClient client) + { + _client = client; + } + + /// The response from the service. + /// The cancellation token to use. + /// + VolumeQuotaRuleResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + VolumeQuotaRuleData data = VolumeQuotaRuleData.DeserializeVolumeQuotaRuleData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new VolumeQuotaRuleResource(_client, data); + } + + /// The response from the service. + /// The cancellation token to use. + /// + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + VolumeQuotaRuleData data = VolumeQuotaRuleData.DeserializeVolumeQuotaRuleData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new VolumeQuotaRuleResource(_client, data); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AcceptGrowCapacityPoolForShortTermCloneSplit.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AcceptGrowCapacityPoolForShortTermCloneSplit.cs index d7f6e1e6a2c6..448a3fcc196a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AcceptGrowCapacityPoolForShortTermCloneSplit.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AcceptGrowCapacityPoolForShortTermCloneSplit.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct AcceptGrowCapacityPoolForShortTermCloneSplit : IEquatable { private readonly string _value; + /// Auto grow capacity pool for short term clone split is accepted. + private const string AcceptedValue = "Accepted"; + /// Auto grow capacity pool for short term clone split is declined. Short term clone volume creation will not be allowed, to create short term clone volume accept auto grow capacity pool. + private const string DeclinedValue = "Declined"; /// Initializes a new instance of . + /// The value. /// is null. public AcceptGrowCapacityPoolForShortTermCloneSplit(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AcceptedValue = "Accepted"; - private const string DeclinedValue = "Declined"; + _value = value; + } /// Auto grow capacity pool for short term clone split is accepted. public static AcceptGrowCapacityPoolForShortTermCloneSplit Accepted { get; } = new AcceptGrowCapacityPoolForShortTermCloneSplit(AcceptedValue); + /// Auto grow capacity pool for short term clone split is declined. Short term clone volume creation will not be allowed, to create short term clone volume accept auto grow capacity pool. public static AcceptGrowCapacityPoolForShortTermCloneSplit Declined { get; } = new AcceptGrowCapacityPoolForShortTermCloneSplit(DeclinedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(AcceptGrowCapacityPoolForShortTermCloneSplit left, AcceptGrowCapacityPoolForShortTermCloneSplit right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(AcceptGrowCapacityPoolForShortTermCloneSplit left, AcceptGrowCapacityPoolForShortTermCloneSplit right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator AcceptGrowCapacityPoolForShortTermCloneSplit(string value) => new AcceptGrowCapacityPoolForShortTermCloneSplit(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator AcceptGrowCapacityPoolForShortTermCloneSplit?(string value) => value == null ? null : new AcceptGrowCapacityPoolForShortTermCloneSplit(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is AcceptGrowCapacityPoolForShortTermCloneSplit other && Equals(other); - /// + + /// public bool Equals(AcceptGrowCapacityPoolForShortTermCloneSplit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountEncryption.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountEncryption.Serialization.cs new file mode 100644 index 000000000000..f1a6a620168d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountEncryption.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Encryption settings. + public partial class AccountEncryption : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AccountEncryption)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(KeySource)) + { + writer.WritePropertyName("keySource"u8); + writer.WriteStringValue(KeySource.Value.ToString()); + } + if (Optional.IsDefined(KeyVaultProperties)) + { + writer.WritePropertyName("keyVaultProperties"u8); + writer.WriteObjectValue(KeyVaultProperties, options); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + AccountEncryption IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AccountEncryption JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AccountEncryption)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAccountEncryption(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AccountEncryption DeserializeAccountEncryption(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeySource? keySource = default; + KeyVaultProperties keyVaultProperties = default; + EncryptionIdentity identity = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("keySource"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keySource = new KeySource(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyVaultProperties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultProperties = KeyVaultProperties.DeserializeKeyVaultProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("identity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = EncryptionIdentity.DeserializeEncryptionIdentity(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new AccountEncryption(keySource, keyVaultProperties, identity, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(AccountEncryption)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + AccountEncryption IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AccountEncryption PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeAccountEncryption(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AccountEncryption)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountEncryption.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountEncryption.cs new file mode 100644 index 000000000000..7f753e5a5383 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountEncryption.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Encryption settings. + public partial class AccountEncryption + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public AccountEncryption() + { + } + + /// Initializes a new instance of . + /// The encryption keySource (provider). Possible values (case-insensitive): Microsoft.NetApp, Microsoft.KeyVault. + /// Properties provided by KeVault. Applicable if keySource is 'Microsoft.KeyVault'. + /// Identity used to authenticate to KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. + /// Keeps track of any properties unknown to the library. + internal AccountEncryption(KeySource? keySource, KeyVaultProperties keyVaultProperties, EncryptionIdentity identity, IDictionary additionalBinaryDataProperties) + { + KeySource = keySource; + KeyVaultProperties = keyVaultProperties; + Identity = identity; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The encryption keySource (provider). Possible values (case-insensitive): Microsoft.NetApp, Microsoft.KeyVault. + public KeySource? KeySource { get; set; } + + /// Properties provided by KeVault. Applicable if keySource is 'Microsoft.KeyVault'. + public KeyVaultProperties KeyVaultProperties { get; set; } + + /// Identity used to authenticate to KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. + public EncryptionIdentity Identity { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountProperties.Serialization.cs new file mode 100644 index 000000000000..38528f638b13 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountProperties.Serialization.cs @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// NetApp account properties. + internal partial class AccountProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AccountProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (Optional.IsCollectionDefined(ActiveDirectories)) + { + writer.WritePropertyName("activeDirectories"u8); + writer.WriteStartArray(); + foreach (ActiveDirectory item in ActiveDirectories) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"u8); + writer.WriteObjectValue(Encryption, options); + } + if (options.Format != "W" && Optional.IsDefined(DisableShowmount)) + { + writer.WritePropertyName("disableShowmount"u8); + writer.WriteBooleanValue(DisableShowmount.Value); + } + if (Optional.IsDefined(NfsV4IDDomain)) + { + writer.WritePropertyName("nfsV4IDDomain"u8); + writer.WriteStringValue(NfsV4IDDomain); + } + if (options.Format != "W" && Optional.IsDefined(MultiAdStatus)) + { + writer.WritePropertyName("multiAdStatus"u8); + writer.WriteStringValue(MultiAdStatus.Value.ToString()); + } + if (Optional.IsDefined(LdapConfiguration)) + { + writer.WritePropertyName("ldapConfiguration"u8); + writer.WriteObjectValue(LdapConfiguration, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + AccountProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AccountProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AccountProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAccountProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AccountProperties DeserializeAccountProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string provisioningState = default; + IList activeDirectories = default; + AccountEncryption encryption = default; + bool? disableShowmount = default; + string nfsV4IDDomain = default; + MultiAdStatus? multiAdStatus = default; + LdapConfiguration ldapConfiguration = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("activeDirectories"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ActiveDirectory.DeserializeActiveDirectory(item, options)); + } + activeDirectories = array; + continue; + } + if (prop.NameEquals("encryption"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = AccountEncryption.DeserializeAccountEncryption(prop.Value, options); + continue; + } + if (prop.NameEquals("disableShowmount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + disableShowmount = null; + continue; + } + disableShowmount = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("nfsV4IDDomain"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + nfsV4IDDomain = null; + continue; + } + nfsV4IDDomain = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("multiAdStatus"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + multiAdStatus = new MultiAdStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("ldapConfiguration"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ldapConfiguration = LdapConfiguration.DeserializeLdapConfiguration(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new AccountProperties( + provisioningState, + activeDirectories ?? new ChangeTrackingList(), + encryption, + disableShowmount, + nfsV4IDDomain, + multiAdStatus, + ldapConfiguration, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(AccountProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + AccountProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AccountProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeAccountProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AccountProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountProperties.cs new file mode 100644 index 000000000000..dfd8c845a01e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AccountProperties.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// NetApp account properties. + internal partial class AccountProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public AccountProperties() + { + ActiveDirectories = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Azure lifecycle management. + /// Active Directories. + /// Encryption settings. + /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. + /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. + /// MultiAD Status for the account. + /// LDAP Configuration for the account. + /// Keeps track of any properties unknown to the library. + internal AccountProperties(string provisioningState, IList activeDirectories, AccountEncryption encryption, bool? disableShowmount, string nfsV4IDDomain, MultiAdStatus? multiAdStatus, LdapConfiguration ldapConfiguration, IDictionary additionalBinaryDataProperties) + { + ProvisioningState = provisioningState; + ActiveDirectories = activeDirectories; + Encryption = encryption; + DisableShowmount = disableShowmount; + NfsV4IDDomain = nfsV4IDDomain; + MultiAdStatus = multiAdStatus; + LdapConfiguration = ldapConfiguration; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + + /// Active Directories. + public IList ActiveDirectories { get; } = new ChangeTrackingList(); + + /// Encryption settings. + public AccountEncryption Encryption { get; set; } + + /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. + public bool? DisableShowmount { get; } + + /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. + public string NfsV4IDDomain { get; set; } + + /// MultiAD Status for the account. + public MultiAdStatus? MultiAdStatus { get; } + + /// LDAP Configuration for the account. + public LdapConfiguration LdapConfiguration { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountActiveDirectory.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectory.Serialization.cs similarity index 52% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountActiveDirectory.Serialization.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectory.Serialization.cs index 8599ae76773b..1103ea9af3ee 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountActiveDirectory.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectory.Serialization.cs @@ -8,17 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Net; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class NetAppAccountActiveDirectory : IUtf8JsonSerializable, IJsonModel + /// Active Directory. + public partial class ActiveDirectory : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -29,23 +29,15 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(NetAppAccountActiveDirectory)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ActiveDirectory)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ActiveDirectoryId)) { - if (ActiveDirectoryId != null) - { - writer.WritePropertyName("activeDirectoryId"u8); - writer.WriteStringValue(ActiveDirectoryId); - } - else - { - writer.WriteNull("activeDirectoryId"); - } + writer.WritePropertyName("activeDirectoryId"u8); + writer.WriteStringValue(ActiveDirectoryId); } if (Optional.IsDefined(Username)) { @@ -96,8 +88,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("backupOperators"u8); writer.WriteStartArray(); - foreach (var item in BackupOperators) + foreach (string item in BackupOperators) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -106,8 +103,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("administrators"u8); writer.WriteStartArray(); - foreach (var item in Administrators) + foreach (string item in Administrators) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -115,7 +117,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(KdcIP)) { writer.WritePropertyName("kdcIP"u8); - writer.WriteStringValue(KdcIP.ToString()); + writer.WriteStringValue(KdcIP); } if (Optional.IsDefined(AdName)) { @@ -127,30 +129,35 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("serverRootCACertificate"u8); writer.WriteStringValue(ServerRootCACertificate); } - if (Optional.IsDefined(IsAesEncryptionEnabled)) + if (Optional.IsDefined(AesEncryption)) { writer.WritePropertyName("aesEncryption"u8); - writer.WriteBooleanValue(IsAesEncryptionEnabled.Value); + writer.WriteBooleanValue(AesEncryption.Value); } - if (Optional.IsDefined(IsLdapSigningEnabled)) + if (Optional.IsDefined(LdapSigning)) { writer.WritePropertyName("ldapSigning"u8); - writer.WriteBooleanValue(IsLdapSigningEnabled.Value); + writer.WriteBooleanValue(LdapSigning.Value); } if (Optional.IsCollectionDefined(SecurityOperators)) { writer.WritePropertyName("securityOperators"u8); writer.WriteStartArray(); - foreach (var item in SecurityOperators) + foreach (string item in SecurityOperators) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); } - if (Optional.IsDefined(IsLdapOverTlsEnabled)) + if (Optional.IsDefined(LdapOverTLS)) { writer.WritePropertyName("ldapOverTLS"u8); - writer.WriteBooleanValue(IsLdapOverTlsEnabled.Value); + writer.WriteBooleanValue(LdapOverTLS.Value); } if (Optional.IsDefined(AllowLocalNfsUsersWithLdap)) { @@ -172,15 +179,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("preferredServersForLdapClient"u8); writer.WriteStringValue(PreferredServersForLdapClient); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -189,22 +196,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NetAppAccountActiveDirectory IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ActiveDirectory IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ActiveDirectory JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(NetAppAccountActiveDirectory)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ActiveDirectory)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppAccountActiveDirectory(document.RootElement, options); + return DeserializeActiveDirectory(document.RootElement, options); } - internal static NetAppAccountActiveDirectory DeserializeNetAppAccountActiveDirectory(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ActiveDirectory DeserializeActiveDirectory(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -214,214 +226,229 @@ internal static NetAppAccountActiveDirectory DeserializeNetAppAccountActiveDirec string password = default; string domain = default; string dns = default; - NetAppAccountActiveDirectoryStatus? status = default; + ActiveDirectoryStatus? status = default; string statusDetails = default; string smbServerName = default; string organizationalUnit = default; string site = default; IList backupOperators = default; IList administrators = default; - IPAddress kdcIP = default; + string kdcIP = default; string adName = default; string serverRootCACertificate = default; bool? aesEncryption = default; bool? ldapSigning = default; IList securityOperators = default; - bool? ldapOverTls = default; + bool? ldapOverTLS = default; bool? allowLocalNfsUsersWithLdap = default; bool? encryptDCConnections = default; - NetAppLdapSearchScopeConfiguration ldapSearchScope = default; + LdapSearchScopeOpt ldapSearchScope = default; string preferredServersForLdapClient = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("activeDirectoryId"u8)) + if (prop.NameEquals("activeDirectoryId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { activeDirectoryId = null; continue; } - activeDirectoryId = property.Value.GetString(); + activeDirectoryId = prop.Value.GetString(); continue; } - if (property.NameEquals("username"u8)) + if (prop.NameEquals("username"u8)) { - username = property.Value.GetString(); + username = prop.Value.GetString(); continue; } - if (property.NameEquals("password"u8)) + if (prop.NameEquals("password"u8)) { - password = property.Value.GetString(); + password = prop.Value.GetString(); continue; } - if (property.NameEquals("domain"u8)) + if (prop.NameEquals("domain"u8)) { - domain = property.Value.GetString(); + domain = prop.Value.GetString(); continue; } - if (property.NameEquals("dns"u8)) + if (prop.NameEquals("dns"u8)) { - dns = property.Value.GetString(); + dns = prop.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - status = new NetAppAccountActiveDirectoryStatus(property.Value.GetString()); + status = new ActiveDirectoryStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("statusDetails"u8)) + if (prop.NameEquals("statusDetails"u8)) { - statusDetails = property.Value.GetString(); + statusDetails = prop.Value.GetString(); continue; } - if (property.NameEquals("smbServerName"u8)) + if (prop.NameEquals("smbServerName"u8)) { - smbServerName = property.Value.GetString(); + smbServerName = prop.Value.GetString(); continue; } - if (property.NameEquals("organizationalUnit"u8)) + if (prop.NameEquals("organizationalUnit"u8)) { - organizationalUnit = property.Value.GetString(); + organizationalUnit = prop.Value.GetString(); continue; } - if (property.NameEquals("site"u8)) + if (prop.NameEquals("site"u8)) { - site = property.Value.GetString(); + site = prop.Value.GetString(); continue; } - if (property.NameEquals("backupOperators"u8)) + if (prop.NameEquals("backupOperators"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(item.GetString()); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } } backupOperators = array; continue; } - if (property.NameEquals("administrators"u8)) + if (prop.NameEquals("administrators"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(item.GetString()); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } } administrators = array; continue; } - if (property.NameEquals("kdcIP"u8)) + if (prop.NameEquals("kdcIP"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kdcIP = IPAddress.Parse(property.Value.GetString()); + kdcIP = prop.Value.GetString(); continue; } - if (property.NameEquals("adName"u8)) + if (prop.NameEquals("adName"u8)) { - adName = property.Value.GetString(); + adName = prop.Value.GetString(); continue; } - if (property.NameEquals("serverRootCACertificate"u8)) + if (prop.NameEquals("serverRootCACertificate"u8)) { - serverRootCACertificate = property.Value.GetString(); + serverRootCACertificate = prop.Value.GetString(); continue; } - if (property.NameEquals("aesEncryption"u8)) + if (prop.NameEquals("aesEncryption"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - aesEncryption = property.Value.GetBoolean(); + aesEncryption = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("ldapSigning"u8)) + if (prop.NameEquals("ldapSigning"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - ldapSigning = property.Value.GetBoolean(); + ldapSigning = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("securityOperators"u8)) + if (prop.NameEquals("securityOperators"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(item.GetString()); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } } securityOperators = array; continue; } - if (property.NameEquals("ldapOverTLS"u8)) + if (prop.NameEquals("ldapOverTLS"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - ldapOverTls = property.Value.GetBoolean(); + ldapOverTLS = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("allowLocalNfsUsersWithLdap"u8)) + if (prop.NameEquals("allowLocalNfsUsersWithLdap"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - allowLocalNfsUsersWithLdap = property.Value.GetBoolean(); + allowLocalNfsUsersWithLdap = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("encryptDCConnections"u8)) + if (prop.NameEquals("encryptDCConnections"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - encryptDCConnections = property.Value.GetBoolean(); + encryptDCConnections = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("ldapSearchScope"u8)) + if (prop.NameEquals("ldapSearchScope"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - ldapSearchScope = NetAppLdapSearchScopeConfiguration.DeserializeNetAppLdapSearchScopeConfiguration(property.Value, options); + ldapSearchScope = LdapSearchScopeOpt.DeserializeLdapSearchScopeOpt(prop.Value, options); continue; } - if (property.NameEquals("preferredServersForLdapClient"u8)) + if (prop.NameEquals("preferredServersForLdapClient"u8)) { - preferredServersForLdapClient = property.Value.GetString(); + preferredServersForLdapClient = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppAccountActiveDirectory( + return new ActiveDirectory( activeDirectoryId, username, password, @@ -440,43 +467,52 @@ internal static NetAppAccountActiveDirectory DeserializeNetAppAccountActiveDirec aesEncryption, ldapSigning, securityOperators ?? new ChangeTrackingList(), - ldapOverTls, + ldapOverTLS, allowLocalNfsUsersWithLdap, encryptDCConnections, ldapSearchScope, preferredServersForLdapClient, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); default: - throw new FormatException($"The model {nameof(NetAppAccountActiveDirectory)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ActiveDirectory)} does not support writing '{options.Format}' format."); } } - NetAppAccountActiveDirectory IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ActiveDirectory IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ActiveDirectory PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppAccountActiveDirectory(document.RootElement, options); + return DeserializeActiveDirectory(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(NetAppAccountActiveDirectory)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ActiveDirectory)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountActiveDirectory.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectory.cs similarity index 69% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountActiveDirectory.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectory.cs index 9805f98e022d..4e32143835a4 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountActiveDirectory.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectory.cs @@ -7,54 +7,25 @@ using System; using System.Collections.Generic; -using System.Net; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Active Directory. - public partial class NetAppAccountActiveDirectory + public partial class ActiveDirectory { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppAccountActiveDirectory() + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ActiveDirectory() { BackupOperators = new ChangeTrackingList(); Administrators = new ChangeTrackingList(); SecurityOperators = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Id of the Active Directory. /// A domain user account with permission to create machine accounts. /// Plain text password of Active Directory domain administrator, value is masked in the response. @@ -70,16 +41,16 @@ public NetAppAccountActiveDirectory() /// kdc server IP address for the active directory machine. This optional parameter is used only while creating kerberos volume. /// Name of the active directory machine. This optional parameter is used only while creating kerberos volume. /// When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded Active Directory Certificate Service's self-signed root CA certificate, this optional parameter is used only for dual protocol with LDAP user-mapping volumes. - /// If enabled, AES encryption will be enabled for SMB communication. - /// Specifies whether or not the LDAP traffic needs to be signed. + /// If enabled, AES encryption will be enabled for SMB communication. + /// Specifies whether or not the LDAP traffic needs to be signed. /// Domain Users in the Active directory to be given SeSecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. - /// Specifies whether or not the LDAP traffic needs to be secured via TLS. + /// Specifies whether or not the LDAP traffic needs to be secured via TLS. /// If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes. /// If enabled, Traffic between the SMB server to Domain Controller (DC) will be encrypted. /// LDAP Search scope options. /// Comma separated list of IPv4 addresses of preferred servers for LDAP client. At most two comma separated IPv4 addresses can be passed. - /// Keeps track of any properties unknown to the library. - internal NetAppAccountActiveDirectory(string activeDirectoryId, string username, string password, string domain, string dns, NetAppAccountActiveDirectoryStatus? status, string statusDetails, string smbServerName, string organizationalUnit, string site, IList backupOperators, IList administrators, IPAddress kdcIP, string adName, string serverRootCACertificate, bool? isAesEncryptionEnabled, bool? isLdapSigningEnabled, IList securityOperators, bool? isLdapOverTlsEnabled, bool? allowLocalNfsUsersWithLdap, bool? encryptDCConnections, NetAppLdapSearchScopeConfiguration ldapSearchScope, string preferredServersForLdapClient, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ActiveDirectory(string activeDirectoryId, string username, string password, string domain, string dns, ActiveDirectoryStatus? status, string statusDetails, string smbServerName, string organizationalUnit, string site, IList backupOperators, IList administrators, string kdcIP, string adName, string serverRootCACertificate, bool? aesEncryption, bool? ldapSigning, IList securityOperators, bool? ldapOverTLS, bool? allowLocalNfsUsersWithLdap, bool? encryptDCConnections, LdapSearchScopeOpt ldapSearchScope, string preferredServersForLdapClient, IDictionary additionalBinaryDataProperties) { ActiveDirectoryId = activeDirectoryId; Username = username; @@ -96,61 +67,83 @@ internal NetAppAccountActiveDirectory(string activeDirectoryId, string username, KdcIP = kdcIP; AdName = adName; ServerRootCACertificate = serverRootCACertificate; - IsAesEncryptionEnabled = isAesEncryptionEnabled; - IsLdapSigningEnabled = isLdapSigningEnabled; + AesEncryption = aesEncryption; + LdapSigning = ldapSigning; SecurityOperators = securityOperators; - IsLdapOverTlsEnabled = isLdapOverTlsEnabled; + LdapOverTLS = ldapOverTLS; AllowLocalNfsUsersWithLdap = allowLocalNfsUsersWithLdap; EncryptDCConnections = encryptDCConnections; LdapSearchScope = ldapSearchScope; PreferredServersForLdapClient = preferredServersForLdapClient; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Id of the Active Directory. public string ActiveDirectoryId { get; set; } + /// A domain user account with permission to create machine accounts. public string Username { get; set; } + /// Plain text password of Active Directory domain administrator, value is masked in the response. public string Password { get; set; } + /// Name of the Active Directory domain. public string Domain { get; set; } + /// Comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory domain. public string Dns { get; set; } + /// Status of the Active Directory. - public NetAppAccountActiveDirectoryStatus? Status { get; } + public ActiveDirectoryStatus? Status { get; } + /// Any details in regards to the Status of the Active Directory. public string StatusDetails { get; } + /// NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. public string SmbServerName { get; set; } + /// The Organizational Unit (OU) within the Windows Active Directory. public string OrganizationalUnit { get; set; } + /// The Active Directory site the service will limit Domain Controller discovery to. public string Site { get; set; } + /// Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier. public IList BackupOperators { get; } + /// Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier. public IList Administrators { get; } + /// kdc server IP address for the active directory machine. This optional parameter is used only while creating kerberos volume. - public IPAddress KdcIP { get; set; } + public string KdcIP { get; set; } + /// Name of the active directory machine. This optional parameter is used only while creating kerberos volume. public string AdName { get; set; } + /// When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded Active Directory Certificate Service's self-signed root CA certificate, this optional parameter is used only for dual protocol with LDAP user-mapping volumes. public string ServerRootCACertificate { get; set; } + /// If enabled, AES encryption will be enabled for SMB communication. - public bool? IsAesEncryptionEnabled { get; set; } + public bool? AesEncryption { get; set; } + /// Specifies whether or not the LDAP traffic needs to be signed. - public bool? IsLdapSigningEnabled { get; set; } + public bool? LdapSigning { get; set; } + /// Domain Users in the Active directory to be given SeSecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. public IList SecurityOperators { get; } + /// Specifies whether or not the LDAP traffic needs to be secured via TLS. - public bool? IsLdapOverTlsEnabled { get; set; } + public bool? LdapOverTLS { get; set; } + /// If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes. public bool? AllowLocalNfsUsersWithLdap { get; set; } + /// If enabled, Traffic between the SMB server to Domain Controller (DC) will be encrypted. public bool? EncryptDCConnections { get; set; } + /// LDAP Search scope options. - public NetAppLdapSearchScopeConfiguration LdapSearchScope { get; set; } + public LdapSearchScopeOpt LdapSearchScope { get; set; } + /// Comma separated list of IPv4 addresses of preferred servers for LDAP client. At most two comma separated IPv4 addresses can be passed. public string PreferredServersForLdapClient { get; set; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigListResult.Serialization.cs new file mode 100644 index 000000000000..deb74093d135 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ActiveDirectoryConfig list operation. + internal partial class ActiveDirectoryConfigListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ActiveDirectoryConfigListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryConfigListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ActiveDirectoryConfigData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ActiveDirectoryConfigListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ActiveDirectoryConfigListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryConfigListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeActiveDirectoryConfigListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ActiveDirectoryConfigListResult DeserializeActiveDirectoryConfigListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ActiveDirectoryConfigData.DeserializeActiveDirectoryConfigData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ActiveDirectoryConfigListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ActiveDirectoryConfigListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ActiveDirectoryConfigListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ActiveDirectoryConfigListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeActiveDirectoryConfigListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ActiveDirectoryConfigListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ActiveDirectoryConfigListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeActiveDirectoryConfigListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigListResult.cs new file mode 100644 index 000000000000..0071a5a2ee3f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ActiveDirectoryConfig list operation. + internal partial class ActiveDirectoryConfigListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ActiveDirectoryConfig items on this page. + internal ActiveDirectoryConfigListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ActiveDirectoryConfig items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ActiveDirectoryConfigListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ActiveDirectoryConfig items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigPatch.Serialization.cs new file mode 100644 index 000000000000..104030954033 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigPatch.Serialization.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The type used for update operations of the ActiveDirectoryConfig. + public partial class ActiveDirectoryConfigPatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryConfigPatch)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + ((IJsonModel)Identity).Write(writer, options); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ActiveDirectoryConfigPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ActiveDirectoryConfigPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryConfigPatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeActiveDirectoryConfigPatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ActiveDirectoryConfigPatch DeserializeActiveDirectoryConfigPatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedServiceIdentity identity = default; + IDictionary tags = default; + ActiveDirectoryConfigUpdateProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("identity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ActiveDirectoryConfigUpdateProperties.DeserializeActiveDirectoryConfigUpdateProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ActiveDirectoryConfigPatch(identity, tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ActiveDirectoryConfigPatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ActiveDirectoryConfigPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ActiveDirectoryConfigPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeActiveDirectoryConfigPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ActiveDirectoryConfigPatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ActiveDirectoryConfigPatch activeDirectoryConfigPatch) + { + if (activeDirectoryConfigPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(activeDirectoryConfigPatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigPatch.cs new file mode 100644 index 000000000000..0c7405781fbe --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigPatch.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The type used for update operations of the ActiveDirectoryConfig. + public partial class ActiveDirectoryConfigPatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ActiveDirectoryConfigPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The managed service identities assigned to this resource. + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal ActiveDirectoryConfigPatch(ManagedServiceIdentity identity, IDictionary tags, ActiveDirectoryConfigUpdateProperties properties, IDictionary additionalBinaryDataProperties) + { + Identity = identity; + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + + /// Resource tags. + public IDictionary Tags { get; } + + /// The resource-specific properties for this resource. + public ActiveDirectoryConfigUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigProperties.Serialization.cs new file mode 100644 index 000000000000..1f6ba3b21eef --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigProperties.Serialization.cs @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Net; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Active Directory Configuration properties. + public partial class ActiveDirectoryConfigProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ActiveDirectoryConfigProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryConfigProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(UserName)) + { + writer.WritePropertyName("userName"u8); + writer.WriteStringValue(UserName); + } + if (Optional.IsCollectionDefined(Dns)) + { + writer.WritePropertyName("dns"u8); + writer.WriteStartArray(); + foreach (IPAddress item in Dns) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SmbServerName)) + { + writer.WritePropertyName("smbServerName"u8); + writer.WriteStringValue(SmbServerName); + } + if (Optional.IsDefined(OrganizationalUnit)) + { + writer.WritePropertyName("organizationalUnit"u8); + writer.WriteStringValue(OrganizationalUnit); + } + if (Optional.IsDefined(Site)) + { + writer.WritePropertyName("site"u8); + writer.WriteStringValue(Site); + } + if (Optional.IsCollectionDefined(BackupOperators)) + { + writer.WritePropertyName("backupOperators"u8); + writer.WriteStartArray(); + foreach (string item in BackupOperators) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Administrators)) + { + writer.WritePropertyName("administrators"u8); + writer.WriteStartArray(); + foreach (string item in Administrators) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SecurityOperators)) + { + writer.WritePropertyName("securityOperators"u8); + writer.WriteStartArray(); + foreach (string item in SecurityOperators) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(ActiveDirectoryStatus)) + { + writer.WritePropertyName("activeDirectoryStatus"u8); + writer.WriteStringValue(ActiveDirectoryStatus.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain); + writer.WritePropertyName("secretPassword"u8); + writer.WriteObjectValue(SecretPassword, options); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ActiveDirectoryConfigProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ActiveDirectoryConfigProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryConfigProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeActiveDirectoryConfigProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ActiveDirectoryConfigProperties DeserializeActiveDirectoryConfigProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string userName = default; + IList dns = default; + string smbServerName = default; + string organizationalUnit = default; + string site = default; + IList backupOperators = default; + IList administrators = default; + IList securityOperators = default; + ActiveDirectoryStatus? activeDirectoryStatus = default; + Models.NetAppProvisioningState? provisioningState = default; + string domain = default; + SecretPassword secretPassword = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("userName"u8)) + { + userName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("dns"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(IPAddress.Parse(item.GetString())); + } + } + dns = array; + continue; + } + if (prop.NameEquals("smbServerName"u8)) + { + smbServerName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("organizationalUnit"u8)) + { + organizationalUnit = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("site"u8)) + { + site = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("backupOperators"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + backupOperators = array; + continue; + } + if (prop.NameEquals("administrators"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + administrators = array; + continue; + } + if (prop.NameEquals("securityOperators"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + securityOperators = array; + continue; + } + if (prop.NameEquals("activeDirectoryStatus"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activeDirectoryStatus = new ActiveDirectoryStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("domain"u8)) + { + domain = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("secretPassword"u8)) + { + secretPassword = SecretPassword.DeserializeSecretPassword(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ActiveDirectoryConfigProperties( + userName, + dns ?? new ChangeTrackingList(), + smbServerName, + organizationalUnit, + site, + backupOperators ?? new ChangeTrackingList(), + administrators ?? new ChangeTrackingList(), + securityOperators ?? new ChangeTrackingList(), + activeDirectoryStatus, + provisioningState, + domain, + secretPassword, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ActiveDirectoryConfigProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ActiveDirectoryConfigProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ActiveDirectoryConfigProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeActiveDirectoryConfigProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ActiveDirectoryConfigProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigProperties.cs new file mode 100644 index 000000000000..c9110a686021 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigProperties.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Net; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Active Directory Configuration properties. + public partial class ActiveDirectoryConfigProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Name of the Active Directory domain. + /// Access password from Azure KeyVault Secrets to connect Active Directory. + /// or is null. + public ActiveDirectoryConfigProperties(string domain, SecretPassword secretPassword) + { + Argument.AssertNotNull(domain, nameof(domain)); + Argument.AssertNotNull(secretPassword, nameof(secretPassword)); + + Dns = new ChangeTrackingList(); + BackupOperators = new ChangeTrackingList(); + Administrators = new ChangeTrackingList(); + SecurityOperators = new ChangeTrackingList(); + Domain = domain; + SecretPassword = secretPassword; + } + + /// Initializes a new instance of . + /// A domain user account with permission to create machine accounts. + /// An array of DNS server IP addresses(IPv4 only) for the Active Directory. + /// NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. + /// The Organizational Unit (OU) within the Windows Active Directory. + /// The Active Directory site the service will limit Domain Controller discovery to. + /// Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier. + /// Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier. + /// Domain Users in the Active directory to be given SecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. + /// Status of the Active Directory. + /// Azure lifecycle management. + /// Name of the Active Directory domain. + /// Access password from Azure KeyVault Secrets to connect Active Directory. + /// Keeps track of any properties unknown to the library. + internal ActiveDirectoryConfigProperties(string userName, IList dns, string smbServerName, string organizationalUnit, string site, IList backupOperators, IList administrators, IList securityOperators, ActiveDirectoryStatus? activeDirectoryStatus, Models.NetAppProvisioningState? provisioningState, string domain, SecretPassword secretPassword, IDictionary additionalBinaryDataProperties) + { + UserName = userName; + Dns = dns; + SmbServerName = smbServerName; + OrganizationalUnit = organizationalUnit; + Site = site; + BackupOperators = backupOperators; + Administrators = administrators; + SecurityOperators = securityOperators; + ActiveDirectoryStatus = activeDirectoryStatus; + ProvisioningState = provisioningState; + Domain = domain; + SecretPassword = secretPassword; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// A domain user account with permission to create machine accounts. + public string UserName { get; set; } + + /// An array of DNS server IP addresses(IPv4 only) for the Active Directory. + public IList Dns { get; } + + /// NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. + public string SmbServerName { get; set; } + + /// The Organizational Unit (OU) within the Windows Active Directory. + public string OrganizationalUnit { get; set; } + + /// The Active Directory site the service will limit Domain Controller discovery to. + public string Site { get; set; } + + /// Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier. + public IList BackupOperators { get; } + + /// Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier. + public IList Administrators { get; } + + /// Domain Users in the Active directory to be given SecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. + public IList SecurityOperators { get; } + + /// Status of the Active Directory. + public ActiveDirectoryStatus? ActiveDirectoryStatus { get; } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ProvisioningState { get; } + + /// Name of the Active Directory domain. + public string Domain { get; set; } + + /// Access password from Azure KeyVault Secrets to connect Active Directory. + public SecretPassword SecretPassword { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigUpdateProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..f06b14d7a9ae --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigUpdateProperties.Serialization.cs @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Net; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The updatable properties of the ActiveDirectoryConfig. + public partial class ActiveDirectoryConfigUpdateProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryConfigUpdateProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(UserName)) + { + writer.WritePropertyName("userName"u8); + writer.WriteStringValue(UserName); + } + if (Optional.IsCollectionDefined(Dns)) + { + writer.WritePropertyName("dns"u8); + writer.WriteStartArray(); + foreach (IPAddress item in Dns) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SmbServerName)) + { + writer.WritePropertyName("smbServerName"u8); + writer.WriteStringValue(SmbServerName); + } + if (Optional.IsDefined(OrganizationalUnit)) + { + writer.WritePropertyName("organizationalUnit"u8); + writer.WriteStringValue(OrganizationalUnit); + } + if (Optional.IsDefined(Site)) + { + writer.WritePropertyName("site"u8); + writer.WriteStringValue(Site); + } + if (Optional.IsCollectionDefined(BackupOperators)) + { + writer.WritePropertyName("backupOperators"u8); + writer.WriteStartArray(); + foreach (string item in BackupOperators) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Administrators)) + { + writer.WritePropertyName("administrators"u8); + writer.WriteStartArray(); + foreach (string item in Administrators) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SecurityOperators)) + { + writer.WritePropertyName("securityOperators"u8); + writer.WriteStartArray(); + foreach (string item in SecurityOperators) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain); + } + if (Optional.IsDefined(SecretPassword)) + { + writer.WritePropertyName("secretPassword"u8); + writer.WriteObjectValue(SecretPassword, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ActiveDirectoryConfigUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ActiveDirectoryConfigUpdateProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActiveDirectoryConfigUpdateProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeActiveDirectoryConfigUpdateProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ActiveDirectoryConfigUpdateProperties DeserializeActiveDirectoryConfigUpdateProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string userName = default; + IList dns = default; + string smbServerName = default; + string organizationalUnit = default; + string site = default; + IList backupOperators = default; + IList administrators = default; + IList securityOperators = default; + string domain = default; + SecretPassword secretPassword = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("userName"u8)) + { + userName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("dns"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(IPAddress.Parse(item.GetString())); + } + } + dns = array; + continue; + } + if (prop.NameEquals("smbServerName"u8)) + { + smbServerName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("organizationalUnit"u8)) + { + organizationalUnit = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("site"u8)) + { + site = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("backupOperators"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + backupOperators = array; + continue; + } + if (prop.NameEquals("administrators"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + administrators = array; + continue; + } + if (prop.NameEquals("securityOperators"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + securityOperators = array; + continue; + } + if (prop.NameEquals("domain"u8)) + { + domain = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("secretPassword"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + secretPassword = SecretPassword.DeserializeSecretPassword(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ActiveDirectoryConfigUpdateProperties( + userName, + dns ?? new ChangeTrackingList(), + smbServerName, + organizationalUnit, + site, + backupOperators ?? new ChangeTrackingList(), + administrators ?? new ChangeTrackingList(), + securityOperators ?? new ChangeTrackingList(), + domain, + secretPassword, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ActiveDirectoryConfigUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ActiveDirectoryConfigUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ActiveDirectoryConfigUpdateProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeActiveDirectoryConfigUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ActiveDirectoryConfigUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigUpdateProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigUpdateProperties.cs new file mode 100644 index 000000000000..3ff79e67c3f4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryConfigUpdateProperties.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Net; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The updatable properties of the ActiveDirectoryConfig. + public partial class ActiveDirectoryConfigUpdateProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ActiveDirectoryConfigUpdateProperties() + { + Dns = new ChangeTrackingList(); + BackupOperators = new ChangeTrackingList(); + Administrators = new ChangeTrackingList(); + SecurityOperators = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A domain user account with permission to create machine accounts. + /// An array of DNS server IP addresses(IPv4 only) for the Active Directory. + /// NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. + /// The Organizational Unit (OU) within the Windows Active Directory. + /// The Active Directory site the service will limit Domain Controller discovery to. + /// Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier. + /// Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier. + /// Domain Users in the Active directory to be given SecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. + /// Name of the Active Directory domain. + /// Access password from Azure KeyVault Secrets to connect Active Directory. + /// Keeps track of any properties unknown to the library. + internal ActiveDirectoryConfigUpdateProperties(string userName, IList dns, string smbServerName, string organizationalUnit, string site, IList backupOperators, IList administrators, IList securityOperators, string domain, SecretPassword secretPassword, IDictionary additionalBinaryDataProperties) + { + UserName = userName; + Dns = dns; + SmbServerName = smbServerName; + OrganizationalUnit = organizationalUnit; + Site = site; + BackupOperators = backupOperators; + Administrators = administrators; + SecurityOperators = securityOperators; + Domain = domain; + SecretPassword = secretPassword; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// A domain user account with permission to create machine accounts. + public string UserName { get; set; } + + /// An array of DNS server IP addresses(IPv4 only) for the Active Directory. + public IList Dns { get; } + + /// NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. + public string SmbServerName { get; set; } + + /// The Organizational Unit (OU) within the Windows Active Directory. + public string OrganizationalUnit { get; set; } + + /// The Active Directory site the service will limit Domain Controller discovery to. + public string Site { get; set; } + + /// Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier. + public IList BackupOperators { get; } + + /// Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier. + public IList Administrators { get; } + + /// Domain Users in the Active directory to be given SecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. + public IList SecurityOperators { get; } + + /// Name of the Active Directory domain. + public string Domain { get; set; } + + /// Access password from Azure KeyVault Secrets to connect Active Directory. + public SecretPassword SecretPassword { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryStatus.cs new file mode 100644 index 000000000000..89863f7951f0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActiveDirectoryStatus.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Status of the Active Directory. + public readonly partial struct ActiveDirectoryStatus : IEquatable + { + private readonly string _value; + /// Active Directory created but not in use. + private const string CreatedValue = "Created"; + /// Active Directory in use by SMB Volume. + private const string InUseValue = "InUse"; + /// Active Directory Deleted. + private const string DeletedValue = "Deleted"; + /// Error with the Active Directory. + private const string ErrorValue = "Error"; + /// Active Directory Updating. + private const string UpdatingValue = "Updating"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ActiveDirectoryStatus(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Active Directory created but not in use. + public static ActiveDirectoryStatus Created { get; } = new ActiveDirectoryStatus(CreatedValue); + + /// Active Directory in use by SMB Volume. + public static ActiveDirectoryStatus InUse { get; } = new ActiveDirectoryStatus(InUseValue); + + /// Active Directory Deleted. + public static ActiveDirectoryStatus Deleted { get; } = new ActiveDirectoryStatus(DeletedValue); + + /// Error with the Active Directory. + public static ActiveDirectoryStatus Error { get; } = new ActiveDirectoryStatus(ErrorValue); + + /// Active Directory Updating. + public static ActiveDirectoryStatus Updating { get; } = new ActiveDirectoryStatus(UpdatingValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ActiveDirectoryStatus left, ActiveDirectoryStatus right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ActiveDirectoryStatus left, ActiveDirectoryStatus right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ActiveDirectoryStatus(string value) => new ActiveDirectoryStatus(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ActiveDirectoryStatus?(string value) => value == null ? null : new ActiveDirectoryStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ActiveDirectoryStatus other && Equals(other); + + /// + public bool Equals(ActiveDirectoryStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActualRansomwareProtectionState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActualRansomwareProtectionState.cs new file mode 100644 index 000000000000..912e76744a43 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ActualRansomwareProtectionState.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The actual state of the Advanced Ransomware Protection feature. + public readonly partial struct ActualRansomwareProtectionState : IEquatable + { + private readonly string _value; + /// Advanced Ransomware Protection is disabled. + private const string DisabledValue = "Disabled"; + /// Advanced Ransomware Protection is enabled. + private const string EnabledValue = "Enabled"; + /// Advanced Ransomware Protection is in learning mode. + private const string LearningValue = "Learning"; + /// Advanced Ransomware Protection is in paused state. + private const string PausedValue = "Paused"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ActualRansomwareProtectionState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Advanced Ransomware Protection is disabled. + public static ActualRansomwareProtectionState Disabled { get; } = new ActualRansomwareProtectionState(DisabledValue); + + /// Advanced Ransomware Protection is enabled. + public static ActualRansomwareProtectionState Enabled { get; } = new ActualRansomwareProtectionState(EnabledValue); + + /// Advanced Ransomware Protection is in learning mode. + public static ActualRansomwareProtectionState Learning { get; } = new ActualRansomwareProtectionState(LearningValue); + + /// Advanced Ransomware Protection is in paused state. + public static ActualRansomwareProtectionState Paused { get; } = new ActualRansomwareProtectionState(PausedValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ActualRansomwareProtectionState left, ActualRansomwareProtectionState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ActualRansomwareProtectionState left, ActualRansomwareProtectionState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ActualRansomwareProtectionState(string value) => new ActualRansomwareProtectionState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ActualRansomwareProtectionState?(string value) => value == null ? null : new ActualRansomwareProtectionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ActualRansomwareProtectionState other && Equals(other); + + /// + public bool Equals(ActualRansomwareProtectionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AuthorizeRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AuthorizeRequest.Serialization.cs new file mode 100644 index 000000000000..42603238e067 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AuthorizeRequest.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Authorize request. + public partial class AuthorizeRequest : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AuthorizeRequest)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(RemoteVolumeResourceId)) + { + writer.WritePropertyName("remoteVolumeResourceId"u8); + writer.WriteStringValue(RemoteVolumeResourceId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + AuthorizeRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AuthorizeRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AuthorizeRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizeRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AuthorizeRequest DeserializeAuthorizeRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string remoteVolumeResourceId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("remoteVolumeResourceId"u8)) + { + remoteVolumeResourceId = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new AuthorizeRequest(remoteVolumeResourceId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(AuthorizeRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + AuthorizeRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AuthorizeRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeAuthorizeRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AuthorizeRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(AuthorizeRequest authorizeRequest) + { + if (authorizeRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(authorizeRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AuthorizeRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AuthorizeRequest.cs new file mode 100644 index 000000000000..a65c01cc92a4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AuthorizeRequest.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Authorize request. + public partial class AuthorizeRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public AuthorizeRequest() + { + } + + /// Initializes a new instance of . + /// Resource id of the remote volume. + /// Keeps track of any properties unknown to the library. + internal AuthorizeRequest(string remoteVolumeResourceId, IDictionary additionalBinaryDataProperties) + { + RemoteVolumeResourceId = remoteVolumeResourceId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource id of the remote volume. + public string RemoteVolumeResourceId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvailabilityZoneMapping.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvailabilityZoneMapping.Serialization.cs index 01ac6b6b5545..28ce3946c04e 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvailabilityZoneMapping.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvailabilityZoneMapping.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class AvailabilityZoneMapping : IUtf8JsonSerializable, IJsonModel + /// The AvailabilityZoneMapping. + public partial class AvailabilityZoneMapping : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AvailabilityZoneMapping)} does not support writing '{format}' format."); } - if (Optional.IsDefined(AvailabilityZone)) { writer.WritePropertyName("availabilityZone"u8); @@ -44,15 +44,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("isAvailable"u8); writer.WriteBooleanValue(IsAvailable.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,59 +61,65 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AvailabilityZoneMapping IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AvailabilityZoneMapping IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AvailabilityZoneMapping JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AvailabilityZoneMapping)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAvailabilityZoneMapping(document.RootElement, options); } - internal static AvailabilityZoneMapping DeserializeAvailabilityZoneMapping(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AvailabilityZoneMapping DeserializeAvailabilityZoneMapping(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string availabilityZone = default; bool? isAvailable = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("availabilityZone"u8)) + if (prop.NameEquals("availabilityZone"u8)) { - availabilityZone = property.Value.GetString(); + availabilityZone = prop.Value.GetString(); continue; } - if (property.NameEquals("isAvailable"u8)) + if (prop.NameEquals("isAvailable"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - isAvailable = property.Value.GetBoolean(); + isAvailable = prop.Value.GetBoolean(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AvailabilityZoneMapping(availabilityZone, isAvailable, serializedAdditionalRawData); + return new AvailabilityZoneMapping(availabilityZone, isAvailable, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -123,15 +129,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - AvailabilityZoneMapping IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + AvailabilityZoneMapping IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AvailabilityZoneMapping PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeAvailabilityZoneMapping(document.RootElement, options); } default: @@ -139,6 +150,7 @@ AvailabilityZoneMapping IPersistableModel.Create(Binary } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvailabilityZoneMapping.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvailabilityZoneMapping.cs index ccbcda8030cb..a13a3ef07607 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvailabilityZoneMapping.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvailabilityZoneMapping.cs @@ -13,57 +13,29 @@ namespace Azure.ResourceManager.NetApp.Models /// The AvailabilityZoneMapping. public partial class AvailabilityZoneMapping { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - public AvailabilityZoneMapping() + internal AvailabilityZoneMapping() { } /// Initializes a new instance of . /// Logical availability zone. /// Available availability zone. - /// Keeps track of any properties unknown to the library. - internal AvailabilityZoneMapping(string availabilityZone, bool? isAvailable, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AvailabilityZoneMapping(string availabilityZone, bool? isAvailable, IDictionary additionalBinaryDataProperties) { AvailabilityZone = availabilityZone; IsAvailable = isAvailable; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Logical availability zone. - public string AvailabilityZone { get; set; } + public string AvailabilityZone { get; } + /// Available availability zone. - public bool? IsAvailable { get; set; } + public bool? IsAvailable { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvsDataStore.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvsDataStore.cs new file mode 100644 index 000000000000..ca822b5491cc --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AvsDataStore.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. + public readonly partial struct AvsDataStore : IEquatable + { + private readonly string _value; + /// avsDataStore is enabled. + private const string EnabledValue = "Enabled"; + /// avsDataStore is disabled. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public AvsDataStore(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// avsDataStore is enabled. + public static AvsDataStore Enabled { get; } = new AvsDataStore(EnabledValue); + + /// avsDataStore is disabled. + public static AvsDataStore Disabled { get; } = new AvsDataStore(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(AvsDataStore left, AvsDataStore right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(AvsDataStore left, AvsDataStore right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator AvsDataStore(string value) => new AvsDataStore(value); + + /// Converts a string to a . + /// The value. + public static implicit operator AvsDataStore?(string value) => value == null ? null : new AvsDataStore(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AvsDataStore other && Equals(other); + + /// + public bool Equals(AvsDataStore other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AzureResourceManagerNetAppContext.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AzureResourceManagerNetAppContext.cs index 70582be85988..800ba5afe337 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AzureResourceManagerNetAppContext.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/AzureResourceManagerNetAppContext.cs @@ -6,6 +6,7 @@ #nullable disable using System.ClientModel.Primitives; +using Azure; using Azure.ResourceManager.Models; using Azure.ResourceManager.NetApp.Models; @@ -13,138 +14,258 @@ namespace Azure.ResourceManager.NetApp { /// /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' + /// For more information /// + [ModelReaderWriterBuildable(typeof(AccountEncryption))] + [ModelReaderWriterBuildable(typeof(AccountProperties))] + [ModelReaderWriterBuildable(typeof(ActiveDirectory))] + [ModelReaderWriterBuildable(typeof(ActiveDirectoryConfigData))] + [ModelReaderWriterBuildable(typeof(ActiveDirectoryConfigListResult))] + [ModelReaderWriterBuildable(typeof(ActiveDirectoryConfigPatch))] + [ModelReaderWriterBuildable(typeof(ActiveDirectoryConfigProperties))] + [ModelReaderWriterBuildable(typeof(ActiveDirectoryConfigResource))] + [ModelReaderWriterBuildable(typeof(ActiveDirectoryConfigUpdateProperties))] + [ModelReaderWriterBuildable(typeof(AuthorizeRequest))] [ModelReaderWriterBuildable(typeof(AvailabilityZoneMapping))] + [ModelReaderWriterBuildable(typeof(BackupData))] + [ModelReaderWriterBuildable(typeof(BackupPatch))] + [ModelReaderWriterBuildable(typeof(BackupPatchProperties))] [ModelReaderWriterBuildable(typeof(BackupPoliciesList))] + [ModelReaderWriterBuildable(typeof(BackupPolicyData))] + [ModelReaderWriterBuildable(typeof(BackupPolicyPatch))] + [ModelReaderWriterBuildable(typeof(BackupPolicyProperties))] + [ModelReaderWriterBuildable(typeof(BackupPolicyResource))] + [ModelReaderWriterBuildable(typeof(BackupProperties))] + [ModelReaderWriterBuildable(typeof(BackupResource))] + [ModelReaderWriterBuildable(typeof(BackupRestoreFiles))] [ModelReaderWriterBuildable(typeof(BackupsList))] - [ModelReaderWriterBuildable(typeof(BackupsMigrationContent))] + [ModelReaderWriterBuildable(typeof(BackupsMigrationRequest))] + [ModelReaderWriterBuildable(typeof(BackupVaultData))] + [ModelReaderWriterBuildable(typeof(BackupVaultPatch))] + [ModelReaderWriterBuildable(typeof(BackupVaultProperties))] + [ModelReaderWriterBuildable(typeof(BackupVaultResource))] [ModelReaderWriterBuildable(typeof(BackupVaultsList))] + [ModelReaderWriterBuildable(typeof(BreakFileLocksRequest))] + [ModelReaderWriterBuildable(typeof(BreakReplicationRequest))] + [ModelReaderWriterBuildable(typeof(BucketCredentialsExpiry))] + [ModelReaderWriterBuildable(typeof(BucketData))] + [ModelReaderWriterBuildable(typeof(BucketGenerateCredentials))] + [ModelReaderWriterBuildable(typeof(BucketList))] + [ModelReaderWriterBuildable(typeof(BucketPatch))] + [ModelReaderWriterBuildable(typeof(BucketPatchProperties))] + [ModelReaderWriterBuildable(typeof(BucketProperties))] + [ModelReaderWriterBuildable(typeof(BucketResource))] + [ModelReaderWriterBuildable(typeof(BucketServerPatchProperties))] + [ModelReaderWriterBuildable(typeof(BucketServerProperties))] + [ModelReaderWriterBuildable(typeof(CacheData))] + [ModelReaderWriterBuildable(typeof(CacheList))] + [ModelReaderWriterBuildable(typeof(CacheMountTargetProperties))] + [ModelReaderWriterBuildable(typeof(CachePatch))] + [ModelReaderWriterBuildable(typeof(CacheProperties))] + [ModelReaderWriterBuildable(typeof(CacheResource))] + [ModelReaderWriterBuildable(typeof(CacheUpdateProperties))] [ModelReaderWriterBuildable(typeof(CapacityPoolData))] [ModelReaderWriterBuildable(typeof(CapacityPoolList))] [ModelReaderWriterBuildable(typeof(CapacityPoolPatch))] [ModelReaderWriterBuildable(typeof(CapacityPoolResource))] + [ModelReaderWriterBuildable(typeof(ChangeKeyVault))] + [ModelReaderWriterBuildable(typeof(ChangeZoneRequest))] + [ModelReaderWriterBuildable(typeof(CheckAvailabilityResponse))] + [ModelReaderWriterBuildable(typeof(CheckElasticResourceAvailabilityResult))] + [ModelReaderWriterBuildable(typeof(CheckElasticVolumeFilePathAvailabilityRequest))] [ModelReaderWriterBuildable(typeof(CifsUser))] - [ModelReaderWriterBuildable(typeof(ClusterPeerCommandResult))] - [ModelReaderWriterBuildable(typeof(GetGroupIdListForLdapUserContent))] - [ModelReaderWriterBuildable(typeof(GetGroupIdListForLdapUserResult))] + [ModelReaderWriterBuildable(typeof(ClusterPeerCommandResponse))] + [ModelReaderWriterBuildable(typeof(DailySchedule))] + [ModelReaderWriterBuildable(typeof(DestinationReplication))] + [ModelReaderWriterBuildable(typeof(Dimension))] + [ModelReaderWriterBuildable(typeof(ElasticAccountData))] + [ModelReaderWriterBuildable(typeof(ElasticAccountListResult))] + [ModelReaderWriterBuildable(typeof(ElasticAccountPatch))] + [ModelReaderWriterBuildable(typeof(ElasticAccountProperties))] + [ModelReaderWriterBuildable(typeof(ElasticAccountResource))] + [ModelReaderWriterBuildable(typeof(ElasticAccountUpdateProperties))] + [ModelReaderWriterBuildable(typeof(ElasticBackupData))] + [ModelReaderWriterBuildable(typeof(ElasticBackupListResult))] + [ModelReaderWriterBuildable(typeof(ElasticBackupPolicyData))] + [ModelReaderWriterBuildable(typeof(ElasticBackupPolicyListResult))] + [ModelReaderWriterBuildable(typeof(ElasticBackupPolicyProperties))] + [ModelReaderWriterBuildable(typeof(ElasticBackupPolicyResource))] + [ModelReaderWriterBuildable(typeof(ElasticBackupProperties))] + [ModelReaderWriterBuildable(typeof(ElasticBackupResource))] + [ModelReaderWriterBuildable(typeof(ElasticBackupVaultData))] + [ModelReaderWriterBuildable(typeof(ElasticBackupVaultListResult))] + [ModelReaderWriterBuildable(typeof(ElasticBackupVaultProperties))] + [ModelReaderWriterBuildable(typeof(ElasticBackupVaultResource))] + [ModelReaderWriterBuildable(typeof(ElasticCapacityPoolData))] + [ModelReaderWriterBuildable(typeof(ElasticCapacityPoolListResult))] + [ModelReaderWriterBuildable(typeof(ElasticCapacityPoolPatch))] + [ModelReaderWriterBuildable(typeof(ElasticCapacityPoolProperties))] + [ModelReaderWriterBuildable(typeof(ElasticCapacityPoolResource))] + [ModelReaderWriterBuildable(typeof(ElasticCapacityPoolUpdateProperties))] + [ModelReaderWriterBuildable(typeof(ElasticEncryption))] + [ModelReaderWriterBuildable(typeof(ElasticEncryptionConfiguration))] + [ModelReaderWriterBuildable(typeof(ElasticEncryptionIdentity))] + [ModelReaderWriterBuildable(typeof(ElasticExportPolicy))] + [ModelReaderWriterBuildable(typeof(ElasticExportPolicyRule))] + [ModelReaderWriterBuildable(typeof(ElasticKeyVaultProperties))] + [ModelReaderWriterBuildable(typeof(ElasticMountTargetProperties))] + [ModelReaderWriterBuildable(typeof(ElasticSmbPatchProperties))] + [ModelReaderWriterBuildable(typeof(ElasticSmbProperties))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotData))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotListResult))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotPolicyDailySchedule))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotPolicyData))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotPolicyHourlySchedule))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotPolicyListResult))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotPolicyMonthlySchedule))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotPolicyProperties))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotPolicyResource))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotPolicyVolumeList))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotPolicyWeeklySchedule))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotProperties))] + [ModelReaderWriterBuildable(typeof(ElasticSnapshotResource))] + [ModelReaderWriterBuildable(typeof(ElasticVolumeBackupProperties))] + [ModelReaderWriterBuildable(typeof(ElasticVolumeData))] + [ModelReaderWriterBuildable(typeof(ElasticVolumeDataProtectionPatchProperties))] + [ModelReaderWriterBuildable(typeof(ElasticVolumeDataProtectionProperties))] + [ModelReaderWriterBuildable(typeof(ElasticVolumeListResult))] + [ModelReaderWriterBuildable(typeof(ElasticVolumePatch))] + [ModelReaderWriterBuildable(typeof(ElasticVolumeProperties))] + [ModelReaderWriterBuildable(typeof(ElasticVolumeResource))] + [ModelReaderWriterBuildable(typeof(ElasticVolumeRevert))] + [ModelReaderWriterBuildable(typeof(ElasticVolumeSnapshotProperties))] + [ModelReaderWriterBuildable(typeof(ElasticVolumeUpdateProperties))] + [ModelReaderWriterBuildable(typeof(EncryptionIdentity))] + [ModelReaderWriterBuildable(typeof(EncryptionTransitionRequest))] + [ModelReaderWriterBuildable(typeof(ExportPolicyRule))] + [ModelReaderWriterBuildable(typeof(FilePathAvailabilityRequest))] + [ModelReaderWriterBuildable(typeof(FileSystemUser))] + [ModelReaderWriterBuildable(typeof(GetGroupIdListForLdapUserRequest))] + [ModelReaderWriterBuildable(typeof(GetGroupIdListForLdapUserResponse))] + [ModelReaderWriterBuildable(typeof(GetKeyVaultStatusResponse))] + [ModelReaderWriterBuildable(typeof(GetKeyVaultStatusResponseProperties))] + [ModelReaderWriterBuildable(typeof(HourlySchedule))] + [ModelReaderWriterBuildable(typeof(KeyVaultPrivateEndpoint))] + [ModelReaderWriterBuildable(typeof(Models.KeyVaultProperties))] [ModelReaderWriterBuildable(typeof(LdapConfiguration))] + [ModelReaderWriterBuildable(typeof(LdapSearchScopeOpt))] + [ModelReaderWriterBuildable(typeof(ListQuotaReportResponse))] [ModelReaderWriterBuildable(typeof(ListReplications))] + [ModelReaderWriterBuildable(typeof(ListReplicationsRequest))] + [ModelReaderWriterBuildable(typeof(LogSpecification))] [ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))] - [ModelReaderWriterBuildable(typeof(NetAppAccountActiveDirectory))] + [ModelReaderWriterBuildable(typeof(MetricSpecification))] + [ModelReaderWriterBuildable(typeof(MonthlySchedule))] + [ModelReaderWriterBuildable(typeof(MountTargetProperties))] [ModelReaderWriterBuildable(typeof(NetAppAccountData))] - [ModelReaderWriterBuildable(typeof(NetAppAccountEncryption))] [ModelReaderWriterBuildable(typeof(NetAppAccountList))] [ModelReaderWriterBuildable(typeof(NetAppAccountPatch))] [ModelReaderWriterBuildable(typeof(NetAppAccountResource))] - [ModelReaderWriterBuildable(typeof(NetAppBackupData))] - [ModelReaderWriterBuildable(typeof(NetAppBackupPolicyData))] - [ModelReaderWriterBuildable(typeof(NetAppBackupPolicyPatch))] - [ModelReaderWriterBuildable(typeof(NetAppBackupPolicyResource))] - [ModelReaderWriterBuildable(typeof(NetAppBackupVaultBackupPatch))] - [ModelReaderWriterBuildable(typeof(NetAppBackupVaultBackupResource))] - [ModelReaderWriterBuildable(typeof(NetAppBackupVaultData))] - [ModelReaderWriterBuildable(typeof(NetAppBackupVaultPatch))] - [ModelReaderWriterBuildable(typeof(NetAppBackupVaultResource))] - [ModelReaderWriterBuildable(typeof(NetAppBucketCredentialsExpiry))] - [ModelReaderWriterBuildable(typeof(NetAppBucketData))] - [ModelReaderWriterBuildable(typeof(NetAppBucketFileSystemUser))] - [ModelReaderWriterBuildable(typeof(NetAppBucketGenerateCredentials))] - [ModelReaderWriterBuildable(typeof(NetAppBucketList))] - [ModelReaderWriterBuildable(typeof(NetAppBucketNfsUser))] - [ModelReaderWriterBuildable(typeof(NetAppBucketPatch))] - [ModelReaderWriterBuildable(typeof(NetAppBucketResource))] - [ModelReaderWriterBuildable(typeof(NetAppBucketServerPatchProperties))] - [ModelReaderWriterBuildable(typeof(NetAppBucketServerProperties))] - [ModelReaderWriterBuildable(typeof(NetAppChangeKeyVault))] - [ModelReaderWriterBuildable(typeof(NetAppCheckAvailabilityResult))] - [ModelReaderWriterBuildable(typeof(NetAppDestinationReplication))] - [ModelReaderWriterBuildable(typeof(NetAppEncryptionIdentity))] - [ModelReaderWriterBuildable(typeof(NetAppEncryptionTransitionContent))] - [ModelReaderWriterBuildable(typeof(NetAppFilePathAvailabilityContent))] - [ModelReaderWriterBuildable(typeof(NetAppKeyVaultPrivateEndpoint))] - [ModelReaderWriterBuildable(typeof(NetAppKeyVaultProperties))] - [ModelReaderWriterBuildable(typeof(NetAppKeyVaultStatusResult))] - [ModelReaderWriterBuildable(typeof(NetAppLdapSearchScopeConfiguration))] - [ModelReaderWriterBuildable(typeof(NetAppNameAvailabilityContent))] - [ModelReaderWriterBuildable(typeof(NetAppQuotaAvailabilityContent))] - [ModelReaderWriterBuildable(typeof(NetAppRegionInfo))] - [ModelReaderWriterBuildable(typeof(NetAppReplicationObject))] [ModelReaderWriterBuildable(typeof(NetAppRestoreStatus))] - [ModelReaderWriterBuildable(typeof(NetAppSubscriptionQuotaItem))] - [ModelReaderWriterBuildable(typeof(NetAppSubvolumeInfoData))] - [ModelReaderWriterBuildable(typeof(NetAppSubvolumeInfoPatch))] - [ModelReaderWriterBuildable(typeof(NetAppSubvolumeInfoResource))] - [ModelReaderWriterBuildable(typeof(NetAppSubvolumeMetadata))] - [ModelReaderWriterBuildable(typeof(NetAppUsageName))] - [ModelReaderWriterBuildable(typeof(NetAppUsageResult))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeAuthorizeReplicationContent))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeBackupBackupRestoreFilesContent))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeBackupConfiguration))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeBackupDetail))] + [ModelReaderWriterBuildable(typeof(NetAppSubscriptionQuotaItemData))] + [ModelReaderWriterBuildable(typeof(NetAppSubscriptionQuotaItemResource))] [ModelReaderWriterBuildable(typeof(NetAppVolumeBackupStatus))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeBreakFileLocksContent))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeBreakReplicationContent))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeData))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeDataProtection))] [ModelReaderWriterBuildable(typeof(NetAppVolumeExportPolicyRule))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeGroupData))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeGroupMetadata))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeGroupResource))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeGroupResult))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeGroupVolume))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeMountTarget))] - [ModelReaderWriterBuildable(typeof(NetAppVolumePatch))] - [ModelReaderWriterBuildable(typeof(NetAppVolumePatchDataProtection))] [ModelReaderWriterBuildable(typeof(NetAppVolumePlacementRule))] - [ModelReaderWriterBuildable(typeof(NetAppVolumePoolChangeContent))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeQuotaReport))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeQuotaReportListResult))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeQuotaRuleData))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeQuotaRulePatch))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeQuotaRuleResource))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeReestablishReplicationContent))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeRelocationProperties))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeReplication))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeReplicationStatus))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeResource))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeRevertContent))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeSnapshotData))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeSnapshotResource))] - [ModelReaderWriterBuildable(typeof(NetAppVolumeSnapshotRestoreFilesContent))] [ModelReaderWriterBuildable(typeof(NetworkSiblingSet))] + [ModelReaderWriterBuildable(typeof(NfsUser))] [ModelReaderWriterBuildable(typeof(NicInfo))] - [ModelReaderWriterBuildable(typeof(PeerClusterForVolumeMigrationContent))] - [ModelReaderWriterBuildable(typeof(QueryNetworkSiblingSetContent))] + [ModelReaderWriterBuildable(typeof(Models.Operation))] + [ModelReaderWriterBuildable(typeof(OperationDisplay))] + [ModelReaderWriterBuildable(typeof(OperationListResult))] + [ModelReaderWriterBuildable(typeof(OperationProperties))] + [ModelReaderWriterBuildable(typeof(OriginClusterInformation))] + [ModelReaderWriterBuildable(typeof(PeerClusterForVolumeMigrationRequest))] + [ModelReaderWriterBuildable(typeof(PeeringPassphrases))] + [ModelReaderWriterBuildable(typeof(PoolChangeRequest))] + [ModelReaderWriterBuildable(typeof(PoolPatchProperties))] + [ModelReaderWriterBuildable(typeof(PoolProperties))] + [ModelReaderWriterBuildable(typeof(QueryNetworkSiblingSetRequest))] + [ModelReaderWriterBuildable(typeof(QuotaAvailabilityRequest))] [ModelReaderWriterBuildable(typeof(QuotaItemList))] + [ModelReaderWriterBuildable(typeof(QuotaItemProperties))] + [ModelReaderWriterBuildable(typeof(QuotaReport))] + [ModelReaderWriterBuildable(typeof(RansomwareProtectionPatchSettings))] + [ModelReaderWriterBuildable(typeof(RansomwareProtectionSettings))] + [ModelReaderWriterBuildable(typeof(RansomwareReportData))] + [ModelReaderWriterBuildable(typeof(RansomwareReportProperties))] + [ModelReaderWriterBuildable(typeof(RansomwareReportResource))] + [ModelReaderWriterBuildable(typeof(RansomwareReportsList))] + [ModelReaderWriterBuildable(typeof(RansomwareSuspects))] + [ModelReaderWriterBuildable(typeof(RansomwareSuspectsClearRequest))] + [ModelReaderWriterBuildable(typeof(ReestablishReplicationRequest))] + [ModelReaderWriterBuildable(typeof(RegionInfo))] [ModelReaderWriterBuildable(typeof(RegionInfoResource))] [ModelReaderWriterBuildable(typeof(RegionInfoResourceData))] - [ModelReaderWriterBuildable(typeof(RegionInfosList))] - [ModelReaderWriterBuildable(typeof(RelocateVolumeContent))] + [ModelReaderWriterBuildable(typeof(RelocateVolumeRequest))] [ModelReaderWriterBuildable(typeof(RemotePath))] + [ModelReaderWriterBuildable(typeof(Replication))] + [ModelReaderWriterBuildable(typeof(ReplicationObject))] + [ModelReaderWriterBuildable(typeof(ReplicationStatus))] + [ModelReaderWriterBuildable(typeof(ResourceNameAvailabilityRequest))] [ModelReaderWriterBuildable(typeof(ResponseError))] + [ModelReaderWriterBuildable(typeof(SecretPassword))] + [ModelReaderWriterBuildable(typeof(SecretPasswordIdentity))] + [ModelReaderWriterBuildable(typeof(SecretPasswordKeyVaultProperties))] + [ModelReaderWriterBuildable(typeof(ServiceSpecification))] + [ModelReaderWriterBuildable(typeof(SmbSettings))] + [ModelReaderWriterBuildable(typeof(SnapshotData))] + [ModelReaderWriterBuildable(typeof(SnapshotPatch))] [ModelReaderWriterBuildable(typeof(SnapshotPoliciesList))] - [ModelReaderWriterBuildable(typeof(SnapshotPolicyDailySchedule))] [ModelReaderWriterBuildable(typeof(SnapshotPolicyData))] - [ModelReaderWriterBuildable(typeof(SnapshotPolicyHourlySchedule))] - [ModelReaderWriterBuildable(typeof(SnapshotPolicyMonthlySchedule))] [ModelReaderWriterBuildable(typeof(SnapshotPolicyPatch))] + [ModelReaderWriterBuildable(typeof(SnapshotPolicyProperties))] [ModelReaderWriterBuildable(typeof(SnapshotPolicyResource))] [ModelReaderWriterBuildable(typeof(SnapshotPolicyVolumeList))] - [ModelReaderWriterBuildable(typeof(SnapshotPolicyWeeklySchedule))] + [ModelReaderWriterBuildable(typeof(SnapshotProperties))] + [ModelReaderWriterBuildable(typeof(SnapshotResource))] + [ModelReaderWriterBuildable(typeof(SnapshotRestoreFiles))] [ModelReaderWriterBuildable(typeof(SnapshotsList))] + [ModelReaderWriterBuildable(typeof(SubvolumeInfoData))] + [ModelReaderWriterBuildable(typeof(SubvolumeInfoPatch))] + [ModelReaderWriterBuildable(typeof(SubvolumeInfoResource))] + [ModelReaderWriterBuildable(typeof(SubvolumeModel))] + [ModelReaderWriterBuildable(typeof(SubvolumeModelProperties))] + [ModelReaderWriterBuildable(typeof(SubvolumePatchParams))] + [ModelReaderWriterBuildable(typeof(SubvolumeProperties))] [ModelReaderWriterBuildable(typeof(SubvolumesList))] - [ModelReaderWriterBuildable(typeof(SvmPeerCommandResult))] + [ModelReaderWriterBuildable(typeof(SuspectFile))] + [ModelReaderWriterBuildable(typeof(SvmPeerCommandResponse))] [ModelReaderWriterBuildable(typeof(SystemData))] - [ModelReaderWriterBuildable(typeof(UpdateNetworkSiblingSetContent))] + [ModelReaderWriterBuildable(typeof(UpdateNetworkSiblingSetRequest))] + [ModelReaderWriterBuildable(typeof(UsageName))] + [ModelReaderWriterBuildable(typeof(UsageProperties))] + [ModelReaderWriterBuildable(typeof(UsageResult))] [ModelReaderWriterBuildable(typeof(UsagesListResult))] [ModelReaderWriterBuildable(typeof(UserAssignedIdentity))] + [ModelReaderWriterBuildable(typeof(VolumeBackupProperties))] + [ModelReaderWriterBuildable(typeof(VolumeBackups))] + [ModelReaderWriterBuildable(typeof(VolumeData))] + [ModelReaderWriterBuildable(typeof(VolumeGroup))] + [ModelReaderWriterBuildable(typeof(VolumeGroupDetailsData))] + [ModelReaderWriterBuildable(typeof(VolumeGroupDetailsResource))] [ModelReaderWriterBuildable(typeof(VolumeGroupList))] + [ModelReaderWriterBuildable(typeof(VolumeGroupListProperties))] + [ModelReaderWriterBuildable(typeof(VolumeGroupMetaData))] + [ModelReaderWriterBuildable(typeof(VolumeGroupProperties))] + [ModelReaderWriterBuildable(typeof(VolumeGroupVolumeProperties))] [ModelReaderWriterBuildable(typeof(VolumeList))] + [ModelReaderWriterBuildable(typeof(VolumePatch))] + [ModelReaderWriterBuildable(typeof(VolumePatchProperties))] + [ModelReaderWriterBuildable(typeof(VolumePatchPropertiesDataProtection))] [ModelReaderWriterBuildable(typeof(VolumePatchPropertiesExportPolicy))] - [ModelReaderWriterBuildable(typeof(VolumePropertiesExportPolicy))] + [ModelReaderWriterBuildable(typeof(VolumeProperties))] + [ModelReaderWriterBuildable(typeof(VolumePropertiesDataProtection))] + [ModelReaderWriterBuildable(typeof(VolumeQuotaRuleData))] + [ModelReaderWriterBuildable(typeof(VolumeQuotaRulePatch))] + [ModelReaderWriterBuildable(typeof(VolumeQuotaRuleResource))] [ModelReaderWriterBuildable(typeof(VolumeQuotaRulesList))] + [ModelReaderWriterBuildable(typeof(VolumeQuotaRulesProperties))] + [ModelReaderWriterBuildable(typeof(VolumeRelocationProperties))] + [ModelReaderWriterBuildable(typeof(VolumeResource))] + [ModelReaderWriterBuildable(typeof(VolumeRevert))] [ModelReaderWriterBuildable(typeof(VolumeSnapshotProperties))] + [ModelReaderWriterBuildable(typeof(WeeklySchedule))] public partial class AzureResourceManagerNetAppContext : ModelReaderWriterContext { } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatch.Serialization.cs new file mode 100644 index 000000000000..3f5c36b31ced --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatch.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup patch. + public partial class BackupPatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupPatch)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupPatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupPatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupPatch DeserializeBackupPatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BackupPatchProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BackupPatchProperties.DeserializeBackupPatchProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupPatch(properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupPatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupPatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BackupPatch backupPatch) + { + if (backupPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(backupPatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatch.cs new file mode 100644 index 000000000000..981b82ac7073 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatch.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup patch. + public partial class BackupPatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BackupPatch() + { + } + + /// Initializes a new instance of . + /// Backup Patch Properties. + /// Keeps track of any properties unknown to the library. + internal BackupPatch(BackupPatchProperties properties, IDictionary additionalBinaryDataProperties) + { + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Backup Patch Properties. + internal BackupPatchProperties Properties { get; set; } + + /// Label for backup. + public string Label + { + get + { + return Properties is null ? default : Properties.Label; + } + set + { + if (Properties is null) + { + Properties = new BackupPatchProperties(); + } + Properties.Label = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatchProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatchProperties.Serialization.cs new file mode 100644 index 000000000000..d87461bcd7f4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatchProperties.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup patch properties. + internal partial class BackupPatchProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupPatchProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Label)) + { + writer.WritePropertyName("label"u8); + writer.WriteStringValue(Label); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupPatchProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupPatchProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupPatchProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupPatchProperties DeserializeBackupPatchProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string label = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("label"u8)) + { + label = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupPatchProperties(label, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupPatchProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatchProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatchProperties.cs new file mode 100644 index 000000000000..3b03cbd1cbc9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPatchProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup patch properties. + internal partial class BackupPatchProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BackupPatchProperties() + { + } + + /// Initializes a new instance of . + /// Label for backup. + /// Keeps track of any properties unknown to the library. + internal BackupPatchProperties(string label, IDictionary additionalBinaryDataProperties) + { + Label = label; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Label for backup. + public string Label { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPoliciesList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPoliciesList.Serialization.cs index f16769dbe64f..113178132f8a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPoliciesList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPoliciesList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class BackupPoliciesList : IUtf8JsonSerializable, IJsonModel + /// List of Backup Policies. + internal partial class BackupPoliciesList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal BackupPoliciesList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(BackupPoliciesList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (BackupPolicyData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - BackupPoliciesList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + BackupPoliciesList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupPoliciesList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(BackupPoliciesList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeBackupPoliciesList(document.RootElement, options); } - internal static BackupPoliciesList DeserializeBackupPoliciesList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupPoliciesList DeserializeBackupPoliciesList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - continue; + array.Add(BackupPolicyData.DeserializeBackupPolicyData(item, options)); } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { - array.Add(NetAppBackupPolicyData.DeserializeNetAppBackupPolicyData(item, options)); + continue; } - value = array; + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new BackupPoliciesList(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new BackupPoliciesList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - BackupPoliciesList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + BackupPoliciesList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupPoliciesList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeBackupPoliciesList(document.RootElement, options); } default: @@ -138,6 +163,15 @@ BackupPoliciesList IPersistableModel.Create(BinaryData data, } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static BackupPoliciesList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeBackupPoliciesList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPoliciesList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPoliciesList.cs index 0825b5e86167..56ead51f7568 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPoliciesList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPoliciesList.cs @@ -7,60 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of Backup Policies. internal partial class BackupPoliciesList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal BackupPoliciesList() + /// The BackupPolicy items on this page. + internal BackupPoliciesList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// A list of backup policies. - /// Keeps track of any properties unknown to the library. - internal BackupPoliciesList(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// The BackupPolicy items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal BackupPoliciesList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// A list of backup policies. - public IReadOnlyList Value { get; } + /// The BackupPolicy items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyPatch.Serialization.cs new file mode 100644 index 000000000000..2a31f18c16a0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyPatch.Serialization.cs @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup policy Details for create and update. + public partial class BackupPolicyPatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupPolicyPatch)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + } + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupPolicyPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupPolicyPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupPolicyPatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupPolicyPatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupPolicyPatch DeserializeBackupPolicyPatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string location = default; + string id = default; + string name = default; + string @type = default; + IDictionary tags = default; + BackupPolicyProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("location"u8)) + { + location = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + @type = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BackupPolicyProperties.DeserializeBackupPolicyProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupPolicyPatch( + location, + id, + name, + @type, + tags ?? new ChangeTrackingDictionary(), + properties, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupPolicyPatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupPolicyPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupPolicyPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupPolicyPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupPolicyPatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BackupPolicyPatch backupPolicyPatch) + { + if (backupPolicyPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(backupPolicyPatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyPatch.cs new file mode 100644 index 000000000000..633e1b9306e3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyPatch.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup policy Details for create and update. + public partial class BackupPolicyPatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BackupPolicyPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// Backup policy Properties. + /// Keeps track of any properties unknown to the library. + internal BackupPolicyPatch(string location, string id, string name, string @type, IDictionary tags, BackupPolicyProperties properties, IDictionary additionalBinaryDataProperties) + { + Location = location; + Id = id; + Name = name; + Type = @type; + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource location. + public string Location { get; set; } + + /// Resource Id. + public string Id { get; } + + /// Resource name. + public string Name { get; } + + /// Resource type. + public string Type { get; } + + /// Resource tags. + public IDictionary Tags { get; } + + /// Backup policy Properties. + internal BackupPolicyProperties Properties { get; set; } + + /// Backup Policy GUID ID. + public string BackupPolicyId + { + get + { + return Properties is null ? default : Properties.BackupPolicyId; + } + } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Daily backups count to keep. + public int? DailyBackupsToKeep + { + get + { + return Properties is null ? default : Properties.DailyBackupsToKeep; + } + set + { + if (Properties is null) + { + Properties = new BackupPolicyProperties(); + } + Properties.DailyBackupsToKeep = value.Value; + } + } + + /// Weekly backups count to keep. + public int? WeeklyBackupsToKeep + { + get + { + return Properties is null ? default : Properties.WeeklyBackupsToKeep; + } + set + { + if (Properties is null) + { + Properties = new BackupPolicyProperties(); + } + Properties.WeeklyBackupsToKeep = value.Value; + } + } + + /// Monthly backups count to keep. + public int? MonthlyBackupsToKeep + { + get + { + return Properties is null ? default : Properties.MonthlyBackupsToKeep; + } + set + { + if (Properties is null) + { + Properties = new BackupPolicyProperties(); + } + Properties.MonthlyBackupsToKeep = value.Value; + } + } + + /// Volumes using current backup policy. + public int? VolumesAssigned + { + get + { + return Properties is null ? default : Properties.VolumesAssigned; + } + } + + /// The property to decide policy is enabled or not. + public bool? Enabled + { + get + { + return Properties is null ? default : Properties.Enabled; + } + set + { + if (Properties is null) + { + Properties = new BackupPolicyProperties(); + } + Properties.Enabled = value.Value; + } + } + + /// A list of volumes assigned to this policy. + public IReadOnlyList VolumeBackups + { + get + { + if (Properties is null) + { + Properties = new BackupPolicyProperties(); + } + return Properties.VolumeBackups; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyProperties.Serialization.cs new file mode 100644 index 000000000000..9e8cee7c72a5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyProperties.Serialization.cs @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup policy properties. + internal partial class BackupPolicyProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupPolicyProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(BackupPolicyId)) + { + writer.WritePropertyName("backupPolicyId"u8); + writer.WriteStringValue(BackupPolicyId); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (Optional.IsDefined(DailyBackupsToKeep)) + { + writer.WritePropertyName("dailyBackupsToKeep"u8); + writer.WriteNumberValue(DailyBackupsToKeep.Value); + } + if (Optional.IsDefined(WeeklyBackupsToKeep)) + { + writer.WritePropertyName("weeklyBackupsToKeep"u8); + writer.WriteNumberValue(WeeklyBackupsToKeep.Value); + } + if (Optional.IsDefined(MonthlyBackupsToKeep)) + { + writer.WritePropertyName("monthlyBackupsToKeep"u8); + writer.WriteNumberValue(MonthlyBackupsToKeep.Value); + } + if (options.Format != "W" && Optional.IsDefined(VolumesAssigned)) + { + writer.WritePropertyName("volumesAssigned"u8); + writer.WriteNumberValue(VolumesAssigned.Value); + } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && Optional.IsCollectionDefined(VolumeBackups)) + { + writer.WritePropertyName("volumeBackups"u8); + writer.WriteStartArray(); + foreach (VolumeBackups item in VolumeBackups) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupPolicyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupPolicyProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupPolicyProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupPolicyProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupPolicyProperties DeserializeBackupPolicyProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string backupPolicyId = default; + string provisioningState = default; + int? dailyBackupsToKeep = default; + int? weeklyBackupsToKeep = default; + int? monthlyBackupsToKeep = default; + int? volumesAssigned = default; + bool? enabled = default; + IReadOnlyList volumeBackups = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("backupPolicyId"u8)) + { + backupPolicyId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("dailyBackupsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dailyBackupsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("weeklyBackupsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + weeklyBackupsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("monthlyBackupsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyBackupsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("volumesAssigned"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + volumesAssigned = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("enabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("volumeBackups"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(Models.VolumeBackups.DeserializeVolumeBackups(item, options)); + } + volumeBackups = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupPolicyProperties( + backupPolicyId, + provisioningState, + dailyBackupsToKeep, + weeklyBackupsToKeep, + monthlyBackupsToKeep, + volumesAssigned, + enabled, + volumeBackups ?? new ChangeTrackingList(), + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupPolicyProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupPolicyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupPolicyProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupPolicyProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupPolicyProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyProperties.cs new file mode 100644 index 000000000000..439485c382e5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupPolicyProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup policy properties. + internal partial class BackupPolicyProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BackupPolicyProperties() + { + VolumeBackups = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Backup Policy GUID ID. + /// Azure lifecycle management. + /// Daily backups count to keep. + /// Weekly backups count to keep. + /// Monthly backups count to keep. + /// Volumes using current backup policy. + /// The property to decide policy is enabled or not. + /// A list of volumes assigned to this policy. + /// Keeps track of any properties unknown to the library. + internal BackupPolicyProperties(string backupPolicyId, string provisioningState, int? dailyBackupsToKeep, int? weeklyBackupsToKeep, int? monthlyBackupsToKeep, int? volumesAssigned, bool? enabled, IReadOnlyList volumeBackups, IDictionary additionalBinaryDataProperties) + { + BackupPolicyId = backupPolicyId; + ProvisioningState = provisioningState; + DailyBackupsToKeep = dailyBackupsToKeep; + WeeklyBackupsToKeep = weeklyBackupsToKeep; + MonthlyBackupsToKeep = monthlyBackupsToKeep; + VolumesAssigned = volumesAssigned; + Enabled = enabled; + VolumeBackups = volumeBackups; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Backup Policy GUID ID. + public string BackupPolicyId { get; } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + + /// Daily backups count to keep. + public int? DailyBackupsToKeep { get; set; } + + /// Weekly backups count to keep. + public int? WeeklyBackupsToKeep { get; set; } + + /// Monthly backups count to keep. + public int? MonthlyBackupsToKeep { get; set; } + + /// Volumes using current backup policy. + public int? VolumesAssigned { get; } + + /// The property to decide policy is enabled or not. + public bool? Enabled { get; set; } + + /// A list of volumes assigned to this policy. + public IReadOnlyList VolumeBackups { get; } = new ChangeTrackingList(); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupProperties.Serialization.cs new file mode 100644 index 000000000000..f633fe0197b7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupProperties.Serialization.cs @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup properties. + internal partial class BackupProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal BackupProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(BackupId)) + { + writer.WritePropertyName("backupId"u8); + writer.WriteStringValue(BackupId); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("creationDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(SnapshotCreationOn)) + { + writer.WritePropertyName("snapshotCreationDate"u8); + writer.WriteStringValue(SnapshotCreationOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(CompletionOn)) + { + writer.WritePropertyName("completionDate"u8); + writer.WriteStringValue(CompletionOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(Label)) + { + writer.WritePropertyName("label"u8); + writer.WriteStringValue(Label); + } + if (options.Format != "W" && Optional.IsDefined(BackupType)) + { + writer.WritePropertyName("backupType"u8); + writer.WriteStringValue(BackupType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(FailureReason)) + { + writer.WritePropertyName("failureReason"u8); + writer.WriteStringValue(FailureReason); + } + writer.WritePropertyName("volumeResourceId"u8); + writer.WriteStringValue(VolumeResourceId); + if (Optional.IsDefined(UseExistingSnapshot)) + { + writer.WritePropertyName("useExistingSnapshot"u8); + writer.WriteBooleanValue(UseExistingSnapshot.Value); + } + if (Optional.IsDefined(SnapshotName)) + { + writer.WritePropertyName("snapshotName"u8); + writer.WriteStringValue(SnapshotName); + } + if (options.Format != "W" && Optional.IsDefined(BackupPolicyResourceId)) + { + writer.WritePropertyName("backupPolicyResourceId"u8); + writer.WriteStringValue(BackupPolicyResourceId); + } + if (options.Format != "W" && Optional.IsDefined(IsLargeVolume)) + { + writer.WritePropertyName("isLargeVolume"u8); + writer.WriteBooleanValue(IsLargeVolume.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupProperties DeserializeBackupProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string backupId = default; + DateTimeOffset? createdOn = default; + DateTimeOffset? snapshotCreationOn = default; + DateTimeOffset? completionOn = default; + string provisioningState = default; + long? size = default; + string label = default; + NetAppBackupType? backupType = default; + string failureReason = default; + ResourceIdentifier volumeResourceId = default; + bool? useExistingSnapshot = default; + string snapshotName = default; + ResourceIdentifier backupPolicyResourceId = default; + bool? isLargeVolume = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("backupId"u8)) + { + backupId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("creationDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("snapshotCreationDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + snapshotCreationOn = null; + continue; + } + snapshotCreationOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("completionDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + completionOn = null; + continue; + } + completionOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("size"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("label"u8)) + { + label = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("backupType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupType = new NetAppBackupType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("failureReason"u8)) + { + failureReason = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("volumeResourceId"u8)) + { + volumeResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("useExistingSnapshot"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + useExistingSnapshot = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("snapshotName"u8)) + { + snapshotName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("backupPolicyResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupPolicyResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("isLargeVolume"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isLargeVolume = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupProperties( + backupId, + createdOn, + snapshotCreationOn, + completionOn, + provisioningState, + size, + label, + backupType, + failureReason, + volumeResourceId, + useExistingSnapshot, + snapshotName, + backupPolicyResourceId, + isLargeVolume, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupProperties.cs similarity index 54% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupData.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupProperties.cs index febbfaa59d60..79dd53124df6 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupData.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupProperties.cs @@ -8,64 +8,27 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.NetApp; -namespace Azure.ResourceManager.NetApp +namespace Azure.ResourceManager.NetApp.Models { - /// - /// A class representing the NetAppBackup data model. - /// Backup under a Backup Vault - /// - public partial class NetAppBackupData : ResourceData + /// Backup properties. + internal partial class BackupProperties { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . /// ResourceId used to identify the Volume. /// is null. - public NetAppBackupData(ResourceIdentifier volumeResourceId) + public BackupProperties(ResourceIdentifier volumeResourceId) { Argument.AssertNotNull(volumeResourceId, nameof(volumeResourceId)); VolumeResourceId = volumeResourceId; } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// UUID v4 used to identify the Backup. /// The creation date of the backup. /// The snapshot creation date of the backup. @@ -78,10 +41,10 @@ public NetAppBackupData(ResourceIdentifier volumeResourceId) /// ResourceId used to identify the Volume. /// Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups. /// The name of the snapshot. - /// ResourceId used to identify the backup policy. + /// ResourceId used to identify the backup policy. /// Specifies if the backup is for a large volume. - /// Keeps track of any properties unknown to the library. - internal NetAppBackupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string backupId, DateTimeOffset? createdOn, DateTimeOffset? snapshotCreationOn, DateTimeOffset? completionOn, string provisioningState, long? size, string label, NetAppBackupType? backupType, string failureReason, ResourceIdentifier volumeResourceId, bool? useExistingSnapshot, string snapshotName, ResourceIdentifier backupPolicyArmResourceId, bool? isLargeVolume, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + /// Keeps track of any properties unknown to the library. + internal BackupProperties(string backupId, DateTimeOffset? createdOn, DateTimeOffset? snapshotCreationOn, DateTimeOffset? completionOn, string provisioningState, long? size, string label, NetAppBackupType? backupType, string failureReason, ResourceIdentifier volumeResourceId, bool? useExistingSnapshot, string snapshotName, ResourceIdentifier backupPolicyResourceId, bool? isLargeVolume, IDictionary additionalBinaryDataProperties) { BackupId = backupId; CreatedOn = createdOn; @@ -95,42 +58,50 @@ internal NetAppBackupData(ResourceIdentifier id, string name, ResourceType resou VolumeResourceId = volumeResourceId; UseExistingSnapshot = useExistingSnapshot; SnapshotName = snapshotName; - BackupPolicyArmResourceId = backupPolicyArmResourceId; + BackupPolicyResourceId = backupPolicyResourceId; IsLargeVolume = isLargeVolume; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppBackupData() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// UUID v4 used to identify the Backup. public string BackupId { get; } + /// The creation date of the backup. public DateTimeOffset? CreatedOn { get; } + /// The snapshot creation date of the backup. public DateTimeOffset? SnapshotCreationOn { get; } + /// The completion date of the backup. public DateTimeOffset? CompletionOn { get; } + /// Azure lifecycle management. public string ProvisioningState { get; } + /// Size of backup in bytes. public long? Size { get; } + /// Label for backup. public string Label { get; set; } + /// Type of backup Manual or Scheduled. public NetAppBackupType? BackupType { get; } + /// Failure reason. public string FailureReason { get; } + /// ResourceId used to identify the Volume. public ResourceIdentifier VolumeResourceId { get; set; } + /// Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups. public bool? UseExistingSnapshot { get; set; } + /// The name of the snapshot. public string SnapshotName { get; set; } + /// ResourceId used to identify the backup policy. - public ResourceIdentifier BackupPolicyArmResourceId { get; } + public ResourceIdentifier BackupPolicyResourceId { get; } + /// Specifies if the backup is for a large volume. public bool? IsLargeVolume { get; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupRestoreFiles.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupRestoreFiles.Serialization.cs new file mode 100644 index 000000000000..ca712847724f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupRestoreFiles.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Restore payload for Single File Backup Restore. + public partial class BackupRestoreFiles : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal BackupRestoreFiles() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupRestoreFiles)} does not support writing '{format}' format."); + } + writer.WritePropertyName("fileList"u8); + writer.WriteStartArray(); + foreach (string item in FileList) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(RestoreFilePath)) + { + writer.WritePropertyName("restoreFilePath"u8); + writer.WriteStringValue(RestoreFilePath); + } + writer.WritePropertyName("destinationVolumeId"u8); + writer.WriteStringValue(DestinationVolumeId); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupRestoreFiles IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupRestoreFiles JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupRestoreFiles)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupRestoreFiles(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupRestoreFiles DeserializeBackupRestoreFiles(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList fileList = default; + string restoreFilePath = default; + string destinationVolumeId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("fileList"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + fileList = array; + continue; + } + if (prop.NameEquals("restoreFilePath"u8)) + { + restoreFilePath = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("destinationVolumeId"u8)) + { + destinationVolumeId = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupRestoreFiles(fileList, restoreFilePath, destinationVolumeId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupRestoreFiles)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupRestoreFiles IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupRestoreFiles PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupRestoreFiles(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupRestoreFiles)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BackupRestoreFiles backupRestoreFiles) + { + if (backupRestoreFiles == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(backupRestoreFiles, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupRestoreFiles.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupRestoreFiles.cs new file mode 100644 index 000000000000..74ec35c0f95b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupRestoreFiles.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Restore payload for Single File Backup Restore. + public partial class BackupRestoreFiles + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// List of files to be restored. + /// Resource Id of the destination volume on which the files need to be restored. + /// or is null. + public BackupRestoreFiles(IEnumerable fileList, string destinationVolumeId) + { + Argument.AssertNotNull(fileList, nameof(fileList)); + Argument.AssertNotNull(destinationVolumeId, nameof(destinationVolumeId)); + + FileList = fileList.ToList(); + DestinationVolumeId = destinationVolumeId; + } + + /// Initializes a new instance of . + /// List of files to be restored. + /// Destination folder where the files will be restored. The path name should start with a forward slash. If it is omitted from request then restore is done at the root folder of the destination volume by default. + /// Resource Id of the destination volume on which the files need to be restored. + /// Keeps track of any properties unknown to the library. + internal BackupRestoreFiles(IList fileList, string restoreFilePath, string destinationVolumeId, IDictionary additionalBinaryDataProperties) + { + FileList = fileList; + RestoreFilePath = restoreFilePath; + DestinationVolumeId = destinationVolumeId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// List of files to be restored. + public IList FileList { get; } + + /// Destination folder where the files will be restored. The path name should start with a forward slash. If it is omitted from request then restore is done at the root folder of the destination volume by default. + public string RestoreFilePath { get; set; } + + /// Resource Id of the destination volume on which the files need to be restored. + public string DestinationVolumeId { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultPatch.Serialization.cs new file mode 100644 index 000000000000..168fef50162e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultPatch.Serialization.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup Vault information. + public partial class BackupVaultPatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupVaultPatch)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupVaultPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupVaultPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupVaultPatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupVaultPatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupVaultPatch DeserializeBackupVaultPatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupVaultPatch(tags ?? new ChangeTrackingDictionary(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupVaultPatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupVaultPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupVaultPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupVaultPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupVaultPatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BackupVaultPatch backupVaultPatch) + { + if (backupVaultPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(backupVaultPatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultPatch.cs new file mode 100644 index 000000000000..7d4c23f7a51e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultPatch.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup Vault information. + public partial class BackupVaultPatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BackupVaultPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// Keeps track of any properties unknown to the library. + internal BackupVaultPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) + { + Tags = tags; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource tags. + public IDictionary Tags { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultProperties.Serialization.cs new file mode 100644 index 000000000000..c2ce8dc4c657 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultProperties.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup Vault properties. + internal partial class BackupVaultProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupVaultProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupVaultProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupVaultProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupVaultProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupVaultProperties DeserializeBackupVaultProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupVaultProperties(provisioningState, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupVaultProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupVaultProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupVaultProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupVaultProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultProperties.cs new file mode 100644 index 000000000000..8f8d32b67bf1 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Backup Vault properties. + internal partial class BackupVaultProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BackupVaultProperties() + { + } + + /// Initializes a new instance of . + /// Azure lifecycle management. + /// Keeps track of any properties unknown to the library. + internal BackupVaultProperties(string provisioningState, IDictionary additionalBinaryDataProperties) + { + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultsList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultsList.Serialization.cs index 74af69d403dd..dcdeb875e7e6 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultsList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultsList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class BackupVaultsList : IUtf8JsonSerializable, IJsonModel + /// List of Backup Vaults. + internal partial class BackupVaultsList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal BackupVaultsList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(BackupVaultsList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (BackupVaultData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - BackupVaultsList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + BackupVaultsList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupVaultsList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(BackupVaultsList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeBackupVaultsList(document.RootElement, options); } - internal static BackupVaultsList DeserializeBackupVaultsList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupVaultsList DeserializeBackupVaultsList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(NetAppBackupVaultData.DeserializeNetAppBackupVaultData(item, options)); + array.Add(BackupVaultData.DeserializeBackupVaultData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new BackupVaultsList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new BackupVaultsList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -133,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op } } - BackupVaultsList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + BackupVaultsList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupVaultsList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeBackupVaultsList(document.RootElement, options); } default: @@ -149,6 +163,15 @@ BackupVaultsList IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static BackupVaultsList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeBackupVaultsList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultsList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultsList.cs index c2dbf2f7c75e..1c2070f95127 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultsList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupVaultsList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of Backup Vaults. internal partial class BackupVaultsList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal BackupVaultsList() + /// The BackupVault items on this page. + internal BackupVaultsList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// A list of Backup Vaults. - /// URL to get the next set of results. - /// Keeps track of any properties unknown to the library. - internal BackupVaultsList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The BackupVault items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal BackupVaultsList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// A list of Backup Vaults. - public IReadOnlyList Value { get; } - /// URL to get the next set of results. - public string NextLink { get; } + /// The BackupVault items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsList.Serialization.cs index 12eaf308823f..b783b9586345 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class BackupsList : IUtf8JsonSerializable, IJsonModel + /// List of Backups. + internal partial class BackupsList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal BackupsList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(BackupsList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (BackupData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - BackupsList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + BackupsList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupsList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(BackupsList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeBackupsList(document.RootElement, options); } - internal static BackupsList DeserializeBackupsList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupsList DeserializeBackupsList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(NetAppBackupData.DeserializeNetAppBackupData(item, options)); + array.Add(BackupData.DeserializeBackupData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new BackupsList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new BackupsList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -133,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options } } - BackupsList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + BackupsList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupsList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeBackupsList(document.RootElement, options); } default: @@ -149,6 +163,15 @@ BackupsList IPersistableModel.Create(BinaryData data, ModelReaderWr } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static BackupsList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeBackupsList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsList.cs index 616e6b59c724..23af78a7a534 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of Backups. internal partial class BackupsList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal BackupsList() + /// The Backup items on this page. + internal BackupsList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// A list of Backups. - /// URL to get the next set of results. - /// Keeps track of any properties unknown to the library. - internal BackupsList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The Backup items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal BackupsList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// A list of Backups. - public IReadOnlyList Value { get; } - /// URL to get the next set of results. - public string NextLink { get; } + /// The Backup items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationContent.Serialization.cs deleted file mode 100644 index 40039f51e10e..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationContent.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class BackupsMigrationContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BackupsMigrationContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("backupVaultId"u8); - writer.WriteStringValue(BackupVaultId); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - BackupsMigrationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BackupsMigrationContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeBackupsMigrationContent(document.RootElement, options); - } - - internal static BackupsMigrationContent DeserializeBackupsMigrationContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string backupVaultId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("backupVaultId"u8)) - { - backupVaultId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new BackupsMigrationContent(backupVaultId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(BackupsMigrationContent)} does not support writing '{options.Format}' format."); - } - } - - BackupsMigrationContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeBackupsMigrationContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(BackupsMigrationContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationContent.cs deleted file mode 100644 index 03e98b44ecd8..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationContent.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Migrate Backups Request. - public partial class BackupsMigrationContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The ResourceId of the Backup Vault. - /// is null. - public BackupsMigrationContent(string backupVaultId) - { - Argument.AssertNotNull(backupVaultId, nameof(backupVaultId)); - - BackupVaultId = backupVaultId; - } - - /// Initializes a new instance of . - /// The ResourceId of the Backup Vault. - /// Keeps track of any properties unknown to the library. - internal BackupsMigrationContent(string backupVaultId, IDictionary serializedAdditionalRawData) - { - BackupVaultId = backupVaultId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal BackupsMigrationContent() - { - } - - /// The ResourceId of the Backup Vault. - public string BackupVaultId { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationRequest.Serialization.cs new file mode 100644 index 000000000000..c31104b3be0a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationRequest.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Migrate Backups Request. + public partial class BackupsMigrationRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal BackupsMigrationRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupsMigrationRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("backupVaultId"u8); + writer.WriteStringValue(BackupVaultId); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BackupsMigrationRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BackupsMigrationRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackupsMigrationRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackupsMigrationRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BackupsMigrationRequest DeserializeBackupsMigrationRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier backupVaultId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("backupVaultId"u8)) + { + backupVaultId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BackupsMigrationRequest(backupVaultId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BackupsMigrationRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BackupsMigrationRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BackupsMigrationRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBackupsMigrationRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackupsMigrationRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BackupsMigrationRequest backupsMigrationRequest) + { + if (backupsMigrationRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(backupsMigrationRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationRequest.cs new file mode 100644 index 000000000000..cef95191afc2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BackupsMigrationRequest.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Migrate Backups Request. + public partial class BackupsMigrationRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ResourceId of the Backup Vault. + /// is null. + public BackupsMigrationRequest(ResourceIdentifier backupVaultId) + { + Argument.AssertNotNull(backupVaultId, nameof(backupVaultId)); + + BackupVaultId = backupVaultId; + } + + /// Initializes a new instance of . + /// The ResourceId of the Backup Vault. + /// Keeps track of any properties unknown to the library. + internal BackupsMigrationRequest(ResourceIdentifier backupVaultId, IDictionary additionalBinaryDataProperties) + { + BackupVaultId = backupVaultId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ResourceId of the Backup Vault. + public ResourceIdentifier BackupVaultId { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakFileLocksRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakFileLocksRequest.Serialization.cs new file mode 100644 index 000000000000..52c872c931ae --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakFileLocksRequest.Serialization.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Break file locks request. + public partial class BreakFileLocksRequest : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BreakFileLocksRequest)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(ClientIp)) + { + writer.WritePropertyName("clientIp"u8); + writer.WriteStringValue(ClientIp); + } + if (Optional.IsDefined(ConfirmRunningDisruptiveOperation)) + { + writer.WritePropertyName("confirmRunningDisruptiveOperation"u8); + writer.WriteBooleanValue(ConfirmRunningDisruptiveOperation.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BreakFileLocksRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BreakFileLocksRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BreakFileLocksRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBreakFileLocksRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BreakFileLocksRequest DeserializeBreakFileLocksRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientIp = default; + bool? confirmRunningDisruptiveOperation = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("clientIp"u8)) + { + clientIp = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("confirmRunningDisruptiveOperation"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confirmRunningDisruptiveOperation = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BreakFileLocksRequest(clientIp, confirmRunningDisruptiveOperation, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BreakFileLocksRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BreakFileLocksRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BreakFileLocksRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBreakFileLocksRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BreakFileLocksRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BreakFileLocksRequest breakFileLocksRequest) + { + if (breakFileLocksRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(breakFileLocksRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakFileLocksRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakFileLocksRequest.cs new file mode 100644 index 000000000000..aa311222295f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakFileLocksRequest.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Break file locks request. + public partial class BreakFileLocksRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BreakFileLocksRequest() + { + } + + /// Initializes a new instance of . + /// To clear file locks on a volume for a particular client. + /// Break File locks could be a disruptive operation for application as locks on the volume will be broken, if want to process, set to true. + /// Keeps track of any properties unknown to the library. + internal BreakFileLocksRequest(string clientIp, bool? confirmRunningDisruptiveOperation, IDictionary additionalBinaryDataProperties) + { + ClientIp = clientIp; + ConfirmRunningDisruptiveOperation = confirmRunningDisruptiveOperation; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// To clear file locks on a volume for a particular client. + public string ClientIp { get; set; } + + /// Break File locks could be a disruptive operation for application as locks on the volume will be broken, if want to process, set to true. + public bool? ConfirmRunningDisruptiveOperation { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakReplicationRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakReplicationRequest.Serialization.cs new file mode 100644 index 000000000000..5c3d7e1b5f79 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakReplicationRequest.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Break replication request. + public partial class BreakReplicationRequest : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BreakReplicationRequest)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(ForceBreakReplication)) + { + writer.WritePropertyName("forceBreakReplication"u8); + writer.WriteBooleanValue(ForceBreakReplication.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BreakReplicationRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BreakReplicationRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BreakReplicationRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBreakReplicationRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BreakReplicationRequest DeserializeBreakReplicationRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? forceBreakReplication = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("forceBreakReplication"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forceBreakReplication = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BreakReplicationRequest(forceBreakReplication, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BreakReplicationRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BreakReplicationRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BreakReplicationRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBreakReplicationRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BreakReplicationRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BreakReplicationRequest breakReplicationRequest) + { + if (breakReplicationRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(breakReplicationRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakReplicationRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakReplicationRequest.cs new file mode 100644 index 000000000000..6c2bf62eb511 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakReplicationRequest.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Break replication request. + public partial class BreakReplicationRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BreakReplicationRequest() + { + } + + /// Initializes a new instance of . + /// If replication is in status transferring and you want to force break the replication, set to true. + /// Keeps track of any properties unknown to the library. + internal BreakReplicationRequest(bool? forceBreakReplication, IDictionary additionalBinaryDataProperties) + { + ForceBreakReplication = forceBreakReplication; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// If replication is in status transferring and you want to force break the replication, set to true. + public bool? ForceBreakReplication { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakthroughMode.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakthroughMode.cs new file mode 100644 index 000000000000..cf193abf227e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BreakthroughMode.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// + /// Specifies whether the volume operates in Breakthrough Mode. When set to 'Enabled', the volume runs on the resources configured for this mode, + /// delivering improved performance and higher throughput. If set to 'Disabled' or omitted, the volume uses the basic configuration. This feature + /// is available only in regions where it’s been configured and first-time users must finish onboarding prior to using Breakthrough Mode. + /// + public readonly partial struct BreakthroughMode : IEquatable + { + private readonly string _value; + /// The volume runs on the resources configured for Breakthrough mode which ensures consistent high performance and a higher throughput. + private const string EnabledValue = "Enabled"; + /// The volume uses configuration that provides basic performance and throughput. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public BreakthroughMode(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// The volume runs on the resources configured for Breakthrough mode which ensures consistent high performance and a higher throughput. + public static BreakthroughMode Enabled { get; } = new BreakthroughMode(EnabledValue); + + /// The volume uses configuration that provides basic performance and throughput. + public static BreakthroughMode Disabled { get; } = new BreakthroughMode(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(BreakthroughMode left, BreakthroughMode right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(BreakthroughMode left, BreakthroughMode right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator BreakthroughMode(string value) => new BreakthroughMode(value); + + /// Converts a string to a . + /// The value. + public static implicit operator BreakthroughMode?(string value) => value == null ? null : new BreakthroughMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BreakthroughMode other && Equals(other); + + /// + public bool Equals(BreakthroughMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketCredentialsExpiry.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketCredentialsExpiry.Serialization.cs new file mode 100644 index 000000000000..a2901430c145 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketCredentialsExpiry.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The bucket's Access and Secret key pair Expiry Time expressed as the number of days from now. + public partial class BucketCredentialsExpiry : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketCredentialsExpiry)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(KeyPairExpiryDays)) + { + writer.WritePropertyName("keyPairExpiryDays"u8); + writer.WriteNumberValue(KeyPairExpiryDays.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BucketCredentialsExpiry IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BucketCredentialsExpiry JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketCredentialsExpiry)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBucketCredentialsExpiry(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BucketCredentialsExpiry DeserializeBucketCredentialsExpiry(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? keyPairExpiryDays = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("keyPairExpiryDays"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyPairExpiryDays = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BucketCredentialsExpiry(keyPairExpiryDays, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BucketCredentialsExpiry)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BucketCredentialsExpiry IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BucketCredentialsExpiry PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBucketCredentialsExpiry(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BucketCredentialsExpiry)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BucketCredentialsExpiry bucketCredentialsExpiry) + { + if (bucketCredentialsExpiry == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(bucketCredentialsExpiry, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketCredentialsExpiry.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketCredentialsExpiry.cs new file mode 100644 index 000000000000..d4450b36ea2f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketCredentialsExpiry.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The bucket's Access and Secret key pair Expiry Time expressed as the number of days from now. + public partial class BucketCredentialsExpiry + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BucketCredentialsExpiry() + { + } + + /// Initializes a new instance of . + /// The number of days from now until the newly generated Access and Secret key pair will expire. + /// Keeps track of any properties unknown to the library. + internal BucketCredentialsExpiry(int? keyPairExpiryDays, IDictionary additionalBinaryDataProperties) + { + KeyPairExpiryDays = keyPairExpiryDays; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The number of days from now until the newly generated Access and Secret key pair will expire. + public int? KeyPairExpiryDays { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketGenerateCredentials.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketGenerateCredentials.Serialization.cs new file mode 100644 index 000000000000..19b644773962 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketGenerateCredentials.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Bucket Access Key, Secret Key, and Expiry date and time of the key pair. + public partial class BucketGenerateCredentials : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketGenerateCredentials)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(AccessKey)) + { + writer.WritePropertyName("accessKey"u8); + writer.WriteStringValue(AccessKey); + } + if (options.Format != "W" && Optional.IsDefined(SecretKey)) + { + writer.WritePropertyName("secretKey"u8); + writer.WriteStringValue(SecretKey); + } + if (options.Format != "W" && Optional.IsDefined(KeyPairExpiry)) + { + writer.WritePropertyName("keyPairExpiry"u8); + writer.WriteStringValue(KeyPairExpiry.Value, "O"); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BucketGenerateCredentials IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BucketGenerateCredentials JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketGenerateCredentials)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBucketGenerateCredentials(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BucketGenerateCredentials DeserializeBucketGenerateCredentials(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string accessKey = default; + string secretKey = default; + DateTimeOffset? keyPairExpiry = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("accessKey"u8)) + { + accessKey = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("secretKey"u8)) + { + secretKey = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("keyPairExpiry"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyPairExpiry = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BucketGenerateCredentials(accessKey, secretKey, keyPairExpiry, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BucketGenerateCredentials)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BucketGenerateCredentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BucketGenerateCredentials PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBucketGenerateCredentials(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BucketGenerateCredentials)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static BucketGenerateCredentials FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeBucketGenerateCredentials(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketGenerateCredentials.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketGenerateCredentials.cs new file mode 100644 index 000000000000..ea87c2494fe8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketGenerateCredentials.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Bucket Access Key, Secret Key, and Expiry date and time of the key pair. + public partial class BucketGenerateCredentials + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal BucketGenerateCredentials() + { + } + + /// Initializes a new instance of . + /// The Access Key that is required along with the Secret Key to access the bucket. + /// The Secret Key that is required along with the Access Key to access the bucket. + /// The bucket's Access and Secret key pair expiry date and time (in UTC). + /// Keeps track of any properties unknown to the library. + internal BucketGenerateCredentials(string accessKey, string secretKey, DateTimeOffset? keyPairExpiry, IDictionary additionalBinaryDataProperties) + { + AccessKey = accessKey; + SecretKey = secretKey; + KeyPairExpiry = keyPairExpiry; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The Access Key that is required along with the Secret Key to access the bucket. + public string AccessKey { get; } + + /// The Secret Key that is required along with the Access Key to access the bucket. + public string SecretKey { get; } + + /// The bucket's Access and Secret key pair expiry date and time (in UTC). + public DateTimeOffset? KeyPairExpiry { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketList.Serialization.cs new file mode 100644 index 000000000000..a9668a3dd4fb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketList.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// List of volume bucket resources. + internal partial class BucketList : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal BucketList() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketList)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (BucketData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BucketList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BucketList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketList)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBucketList(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BucketList DeserializeBucketList(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(BucketData.DeserializeBucketData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BucketList(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BucketList)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BucketList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BucketList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBucketList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BucketList)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static BucketList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeBucketList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketList.cs new file mode 100644 index 000000000000..66f3f6ab3779 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketList.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// List of volume bucket resources. + internal partial class BucketList + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The Bucket items on this page. + internal BucketList(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Bucket items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal BucketList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The Bucket items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatch.Serialization.cs new file mode 100644 index 000000000000..00240489c3db --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatch.Serialization.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Bucket resource. + public partial class BucketPatch : ResourceData, IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketPatch)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BucketPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (BucketPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketPatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBucketPatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BucketPatch DeserializeBucketPatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + BucketPatchProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BucketPatchProperties.DeserializeBucketPatchProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BucketPatch( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BucketPatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BucketPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (BucketPatch)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBucketPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BucketPatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(BucketPatch bucketPatch) + { + if (bucketPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(bucketPatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatch.cs new file mode 100644 index 000000000000..acc83f0d12f4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatch.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Bucket resource. + public partial class BucketPatch : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BucketPatch() + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Bucket properties. + internal BucketPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, BucketPatchProperties properties) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// Bucket properties. + internal BucketPatchProperties Properties { get; set; } + + /// The volume path mounted inside the bucket. + public string Path + { + get + { + return Properties is null ? default : Properties.Path; + } + set + { + if (Properties is null) + { + Properties = new BucketPatchProperties(); + } + Properties.Path = value; + } + } + + /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. + public FileSystemUser FileSystemUser + { + get + { + return Properties is null ? default : Properties.FileSystemUser; + } + set + { + if (Properties is null) + { + Properties = new BucketPatchProperties(); + } + Properties.FileSystemUser = value; + } + } + + /// Provisioning state of the resource. + public Models.NetAppProvisioningState? ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Properties of the server managing the lifecycle of volume buckets. + public BucketServerPatchProperties Server + { + get + { + return Properties is null ? default : Properties.Server; + } + set + { + if (Properties is null) + { + Properties = new BucketPatchProperties(); + } + Properties.Server = value; + } + } + + /// Access permissions for the bucket. Either ReadOnly or ReadWrite. + public BucketPatchPermissions? Permissions + { + get + { + return Properties is null ? default : Properties.Permissions; + } + set + { + if (Properties is null) + { + Properties = new BucketPatchProperties(); + } + Properties.Permissions = value.Value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchPermissions.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchPermissions.cs new file mode 100644 index 000000000000..bc930d012104 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchPermissions.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Access permissions for the bucket. Either ReadOnly or ReadWrite. + public readonly partial struct BucketPatchPermissions : IEquatable + { + private readonly string _value; + /// Read-only access to bucket. + private const string ReadOnlyValue = "ReadOnly"; + /// Read-write access to bucket. + private const string ReadWriteValue = "ReadWrite"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public BucketPatchPermissions(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Read-only access to bucket. + public static BucketPatchPermissions ReadOnly { get; } = new BucketPatchPermissions(ReadOnlyValue); + + /// Read-write access to bucket. + public static BucketPatchPermissions ReadWrite { get; } = new BucketPatchPermissions(ReadWriteValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(BucketPatchPermissions left, BucketPatchPermissions right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(BucketPatchPermissions left, BucketPatchPermissions right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator BucketPatchPermissions(string value) => new BucketPatchPermissions(value); + + /// Converts a string to a . + /// The value. + public static implicit operator BucketPatchPermissions?(string value) => value == null ? null : new BucketPatchPermissions(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BucketPatchPermissions other && Equals(other); + + /// + public bool Equals(BucketPatchPermissions other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchProperties.Serialization.cs new file mode 100644 index 000000000000..027513d9002f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchProperties.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Bucket resource properties for a Patch operation. + internal partial class BucketPatchProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketPatchProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(FileSystemUser)) + { + writer.WritePropertyName("fileSystemUser"u8); + writer.WriteObjectValue(FileSystemUser, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Server)) + { + writer.WritePropertyName("server"u8); + writer.WriteObjectValue(Server, options); + } + if (Optional.IsDefined(Permissions)) + { + writer.WritePropertyName("permissions"u8); + writer.WriteStringValue(Permissions.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BucketPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BucketPatchProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketPatchProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBucketPatchProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BucketPatchProperties DeserializeBucketPatchProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string path = default; + FileSystemUser fileSystemUser = default; + Models.NetAppProvisioningState? provisioningState = default; + BucketServerPatchProperties server = default; + BucketPatchPermissions? permissions = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("path"u8)) + { + path = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("fileSystemUser"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileSystemUser = FileSystemUser.DeserializeFileSystemUser(prop.Value, options); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("server"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + server = BucketServerPatchProperties.DeserializeBucketServerPatchProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("permissions"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + permissions = new BucketPatchPermissions(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BucketPatchProperties( + path, + fileSystemUser, + provisioningState, + server, + permissions, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BucketPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BucketPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BucketPatchProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBucketPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BucketPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchProperties.cs new file mode 100644 index 000000000000..4a2086635620 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPatchProperties.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Bucket resource properties for a Patch operation. + internal partial class BucketPatchProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BucketPatchProperties() + { + } + + /// Initializes a new instance of . + /// The volume path mounted inside the bucket. + /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. + /// Provisioning state of the resource. + /// Properties of the server managing the lifecycle of volume buckets. + /// Access permissions for the bucket. Either ReadOnly or ReadWrite. + /// Keeps track of any properties unknown to the library. + internal BucketPatchProperties(string path, FileSystemUser fileSystemUser, Models.NetAppProvisioningState? provisioningState, BucketServerPatchProperties server, BucketPatchPermissions? permissions, IDictionary additionalBinaryDataProperties) + { + Path = path; + FileSystemUser = fileSystemUser; + ProvisioningState = provisioningState; + Server = server; + Permissions = permissions; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The volume path mounted inside the bucket. + public string Path { get; set; } + + /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. + public FileSystemUser FileSystemUser { get; set; } + + /// Provisioning state of the resource. + public Models.NetAppProvisioningState? ProvisioningState { get; } + + /// Properties of the server managing the lifecycle of volume buckets. + public BucketServerPatchProperties Server { get; set; } + + /// Access permissions for the bucket. Either ReadOnly or ReadWrite. + public BucketPatchPermissions? Permissions { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPermissions.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPermissions.cs new file mode 100644 index 000000000000..2ada61641fc0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketPermissions.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Access permissions for the bucket. Either ReadOnly or ReadWrite. The default is ReadOnly if no value is provided during bucket creation. + public readonly partial struct BucketPermissions : IEquatable + { + private readonly string _value; + /// Read-only access to bucket. + private const string ReadOnlyValue = "ReadOnly"; + /// Read-write access to bucket. + private const string ReadWriteValue = "ReadWrite"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public BucketPermissions(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Read-only access to bucket. + public static BucketPermissions ReadOnly { get; } = new BucketPermissions(ReadOnlyValue); + + /// Read-write access to bucket. + public static BucketPermissions ReadWrite { get; } = new BucketPermissions(ReadWriteValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(BucketPermissions left, BucketPermissions right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(BucketPermissions left, BucketPermissions right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator BucketPermissions(string value) => new BucketPermissions(value); + + /// Converts a string to a . + /// The value. + public static implicit operator BucketPermissions?(string value) => value == null ? null : new BucketPermissions(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BucketPermissions other && Equals(other); + + /// + public bool Equals(BucketPermissions other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketProperties.Serialization.cs new file mode 100644 index 000000000000..b97b0fec17a0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketProperties.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Bucket resource properties. + internal partial class BucketProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(FileSystemUser)) + { + writer.WritePropertyName("fileSystemUser"u8); + writer.WriteObjectValue(FileSystemUser, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(Server)) + { + writer.WritePropertyName("server"u8); + writer.WriteObjectValue(Server, options); + } + if (Optional.IsDefined(Permissions)) + { + writer.WritePropertyName("permissions"u8); + writer.WriteStringValue(Permissions.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BucketProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BucketProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBucketProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BucketProperties DeserializeBucketProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string path = default; + FileSystemUser fileSystemUser = default; + Models.NetAppProvisioningState? provisioningState = default; + CredentialsStatus? status = default; + BucketServerProperties server = default; + BucketPermissions? permissions = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("path"u8)) + { + path = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("fileSystemUser"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileSystemUser = FileSystemUser.DeserializeFileSystemUser(prop.Value, options); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("status"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new CredentialsStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("server"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + server = BucketServerProperties.DeserializeBucketServerProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("permissions"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + permissions = new BucketPermissions(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BucketProperties( + path, + fileSystemUser, + provisioningState, + status, + server, + permissions, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BucketProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BucketProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BucketProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBucketProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BucketProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketProperties.cs new file mode 100644 index 000000000000..3f222b6273d6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Bucket resource properties. + internal partial class BucketProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BucketProperties() + { + } + + /// Initializes a new instance of . + /// The volume path mounted inside the bucket. The default is the root path '/' if no value is provided when the bucket is created. + /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. + /// Provisioning state of the resource. + /// + /// The bucket credentials status. There states: + /// + /// "NoCredentialsSet": Access and Secret key pair have not been generated. + /// "CredentialsExpired": Access and Secret key pair have expired. + /// "Active": The certificate has been installed and credentials are unexpired. + /// + /// Properties of the server managing the lifecycle of volume buckets. + /// Access permissions for the bucket. Either ReadOnly or ReadWrite. The default is ReadOnly if no value is provided during bucket creation. + /// Keeps track of any properties unknown to the library. + internal BucketProperties(string path, FileSystemUser fileSystemUser, Models.NetAppProvisioningState? provisioningState, CredentialsStatus? status, BucketServerProperties server, BucketPermissions? permissions, IDictionary additionalBinaryDataProperties) + { + Path = path; + FileSystemUser = fileSystemUser; + ProvisioningState = provisioningState; + Status = status; + Server = server; + Permissions = permissions; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The volume path mounted inside the bucket. The default is the root path '/' if no value is provided when the bucket is created. + public string Path { get; set; } + + /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. + public FileSystemUser FileSystemUser { get; set; } + + /// Provisioning state of the resource. + public Models.NetAppProvisioningState? ProvisioningState { get; } + + /// + /// The bucket credentials status. There states: + /// + /// "NoCredentialsSet": Access and Secret key pair have not been generated. + /// "CredentialsExpired": Access and Secret key pair have expired. + /// "Active": The certificate has been installed and credentials are unexpired. + /// + public CredentialsStatus? Status { get; } + + /// Properties of the server managing the lifecycle of volume buckets. + public BucketServerProperties Server { get; set; } + + /// Access permissions for the bucket. Either ReadOnly or ReadWrite. The default is ReadOnly if no value is provided during bucket creation. + public BucketPermissions? Permissions { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerPatchProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerPatchProperties.Serialization.cs new file mode 100644 index 000000000000..3b5302b9276d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerPatchProperties.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of the server managing the lifecycle of volume buckets. + public partial class BucketServerPatchProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketServerPatchProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Fqdn)) + { + writer.WritePropertyName("fqdn"u8); + writer.WriteStringValue(Fqdn); + } + if (Optional.IsDefined(CertificateObject)) + { + writer.WritePropertyName("certificateObject"u8); + writer.WriteStringValue(CertificateObject); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BucketServerPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BucketServerPatchProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketServerPatchProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBucketServerPatchProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BucketServerPatchProperties DeserializeBucketServerPatchProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fqdn = default; + string certificateObject = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("fqdn"u8)) + { + fqdn = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("certificateObject"u8)) + { + certificateObject = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BucketServerPatchProperties(fqdn, certificateObject, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BucketServerPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BucketServerPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BucketServerPatchProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBucketServerPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BucketServerPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerPatchProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerPatchProperties.cs new file mode 100644 index 000000000000..576bd350e7a5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerPatchProperties.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of the server managing the lifecycle of volume buckets. + public partial class BucketServerPatchProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BucketServerPatchProperties() + { + } + + /// Initializes a new instance of . + /// The host part of the bucket URL, resolving to the bucket IP address and allowed by the server certificate. + /// A base64-encoded PEM file, which includes both the bucket server's certificate and private key. It is used to authenticate the user and allows access to volume data in a read-only manner. + /// Keeps track of any properties unknown to the library. + internal BucketServerPatchProperties(string fqdn, string certificateObject, IDictionary additionalBinaryDataProperties) + { + Fqdn = fqdn; + CertificateObject = certificateObject; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The host part of the bucket URL, resolving to the bucket IP address and allowed by the server certificate. + public string Fqdn { get; set; } + + /// A base64-encoded PEM file, which includes both the bucket server's certificate and private key. It is used to authenticate the user and allows access to volume data in a read-only manner. + public string CertificateObject { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerProperties.Serialization.cs new file mode 100644 index 000000000000..db9574ca8032 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerProperties.Serialization.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of the server managing the lifecycle of volume buckets. + public partial class BucketServerProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketServerProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Fqdn)) + { + writer.WritePropertyName("fqdn"u8); + writer.WriteStringValue(Fqdn); + } + if (options.Format != "W" && Optional.IsDefined(CertificateCommonName)) + { + writer.WritePropertyName("certificateCommonName"u8); + writer.WriteStringValue(CertificateCommonName); + } + if (options.Format != "W" && Optional.IsDefined(CertificateExpiryOn)) + { + writer.WritePropertyName("certificateExpiryDate"u8); + writer.WriteStringValue(CertificateExpiryOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(IpAddress)) + { + writer.WritePropertyName("ipAddress"u8); + writer.WriteStringValue(IpAddress); + } + if (Optional.IsDefined(CertificateObject)) + { + writer.WritePropertyName("certificateObject"u8); + writer.WriteStringValue(CertificateObject); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + BucketServerProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BucketServerProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BucketServerProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBucketServerProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BucketServerProperties DeserializeBucketServerProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fqdn = default; + string certificateCommonName = default; + DateTimeOffset? certificateExpiryOn = default; + string ipAddress = default; + string certificateObject = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("fqdn"u8)) + { + fqdn = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("certificateCommonName"u8)) + { + certificateCommonName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("certificateExpiryDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certificateExpiryOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("ipAddress"u8)) + { + ipAddress = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("certificateObject"u8)) + { + certificateObject = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BucketServerProperties( + fqdn, + certificateCommonName, + certificateExpiryOn, + ipAddress, + certificateObject, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(BucketServerProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + BucketServerProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BucketServerProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeBucketServerProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BucketServerProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerProperties.cs new file mode 100644 index 000000000000..dc3d7ec6d849 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/BucketServerProperties.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of the server managing the lifecycle of volume buckets. + public partial class BucketServerProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public BucketServerProperties() + { + } + + /// Initializes a new instance of . + /// The host part of the bucket URL, resolving to the bucket IP address and allowed by the server certificate. + /// Certificate Common Name taken from the certificate installed on the bucket server. + /// The bucket server's certificate expiry date. + /// The bucket server's IPv4 address. + /// A base64-encoded PEM file, which includes both the bucket server's certificate and private key. It is used to authenticate the user and allows access to volume data in a read-only manner. + /// Keeps track of any properties unknown to the library. + internal BucketServerProperties(string fqdn, string certificateCommonName, DateTimeOffset? certificateExpiryOn, string ipAddress, string certificateObject, IDictionary additionalBinaryDataProperties) + { + Fqdn = fqdn; + CertificateCommonName = certificateCommonName; + CertificateExpiryOn = certificateExpiryOn; + IpAddress = ipAddress; + CertificateObject = certificateObject; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The host part of the bucket URL, resolving to the bucket IP address and allowed by the server certificate. + public string Fqdn { get; set; } + + /// Certificate Common Name taken from the certificate installed on the bucket server. + public string CertificateCommonName { get; } + + /// The bucket server's certificate expiry date. + public DateTimeOffset? CertificateExpiryOn { get; } + + /// The bucket server's IPv4 address. + public string IpAddress { get; } + + /// A base64-encoded PEM file, which includes both the bucket server's certificate and private key. It is used to authenticate the user and allows access to volume data in a read-only manner. + public string CertificateObject { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheLifeCycleState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheLifeCycleState.cs new file mode 100644 index 000000000000..42c7e4e6419f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheLifeCycleState.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Azure NetApp Files Cache lifecycle management. + public readonly partial struct CacheLifeCycleState : IEquatable + { + private readonly string _value; + /// Cluster peering offer has been sent. + private const string ClusterPeeringOfferSentValue = "ClusterPeeringOfferSent"; + /// VServer peering offer has been sent. + private const string VserverPeeringOfferSentValue = "VserverPeeringOfferSent"; + /// Cache creation in progress. + private const string CreatingValue = "Creating"; + /// Cache creation succeeded and is available for use. + private const string SucceededValue = "Succeeded"; + /// Cache is in a failed state. + private const string FailedValue = "Failed"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public CacheLifeCycleState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Cluster peering offer has been sent. + public static CacheLifeCycleState ClusterPeeringOfferSent { get; } = new CacheLifeCycleState(ClusterPeeringOfferSentValue); + + /// VServer peering offer has been sent. + public static CacheLifeCycleState VserverPeeringOfferSent { get; } = new CacheLifeCycleState(VserverPeeringOfferSentValue); + + /// Cache creation in progress. + public static CacheLifeCycleState Creating { get; } = new CacheLifeCycleState(CreatingValue); + + /// Cache creation succeeded and is available for use. + public static CacheLifeCycleState Succeeded { get; } = new CacheLifeCycleState(SucceededValue); + + /// Cache is in a failed state. + public static CacheLifeCycleState Failed { get; } = new CacheLifeCycleState(FailedValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(CacheLifeCycleState left, CacheLifeCycleState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(CacheLifeCycleState left, CacheLifeCycleState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator CacheLifeCycleState(string value) => new CacheLifeCycleState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator CacheLifeCycleState?(string value) => value == null ? null : new CacheLifeCycleState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CacheLifeCycleState other && Equals(other); + + /// + public bool Equals(CacheLifeCycleState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheList.Serialization.cs new file mode 100644 index 000000000000..67dcb9613139 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheList.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// List of cache resources. + internal partial class CacheList : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal CacheList() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CacheList)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (CacheData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + CacheList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CacheList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CacheList)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCacheList(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CacheList DeserializeCacheList(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(CacheData.DeserializeCacheData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CacheList(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(CacheList)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + CacheList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CacheList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeCacheList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CacheList)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static CacheList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeCacheList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheList.cs new file mode 100644 index 000000000000..69f9f95c1991 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheList.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// List of cache resources. + internal partial class CacheList + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The Cache items on this page. + internal CacheList(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Cache items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal CacheList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The Cache items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheMountTargetProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheMountTargetProperties.Serialization.cs new file mode 100644 index 000000000000..4a246df76bd7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheMountTargetProperties.Serialization.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Net; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Contains all the information needed to mount a cache. + public partial class CacheMountTargetProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CacheMountTargetProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(MountTargetId)) + { + writer.WritePropertyName("mountTargetId"u8); + writer.WriteStringValue(MountTargetId); + } + if (options.Format != "W" && Optional.IsDefined(IpAddress)) + { + writer.WritePropertyName("ipAddress"u8); + writer.WriteStringValue(IpAddress.ToString()); + } + if (Optional.IsDefined(SmbServerFqdn)) + { + writer.WritePropertyName("smbServerFqdn"u8); + writer.WriteStringValue(SmbServerFqdn); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + CacheMountTargetProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CacheMountTargetProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CacheMountTargetProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCacheMountTargetProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CacheMountTargetProperties DeserializeCacheMountTargetProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string mountTargetId = default; + IPAddress ipAddress = default; + string smbServerFqdn = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("mountTargetId"u8)) + { + mountTargetId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("ipAddress"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipAddress = IPAddress.Parse(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbServerFqdn"u8)) + { + smbServerFqdn = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CacheMountTargetProperties(mountTargetId, ipAddress, smbServerFqdn, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(CacheMountTargetProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + CacheMountTargetProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CacheMountTargetProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeCacheMountTargetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CacheMountTargetProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheMountTargetProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheMountTargetProperties.cs new file mode 100644 index 000000000000..2c6160c856f3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheMountTargetProperties.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Contains all the information needed to mount a cache. + public partial class CacheMountTargetProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal CacheMountTargetProperties() + { + } + + /// Initializes a new instance of . + /// UUID v4 used to identify the MountTarget. + /// The mount target's IPv4 address, used to mount the cache. + /// The SMB server's Fully Qualified Domain Name, FQDN. + /// Keeps track of any properties unknown to the library. + internal CacheMountTargetProperties(string mountTargetId, IPAddress ipAddress, string smbServerFqdn, IDictionary additionalBinaryDataProperties) + { + MountTargetId = mountTargetId; + IpAddress = ipAddress; + SmbServerFqdn = smbServerFqdn; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// UUID v4 used to identify the MountTarget. + public string MountTargetId { get; } + + /// The mount target's IPv4 address, used to mount the cache. + public IPAddress IpAddress { get; } + + /// The SMB server's Fully Qualified Domain Name, FQDN. + public string SmbServerFqdn { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CachePatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CachePatch.Serialization.cs new file mode 100644 index 000000000000..65e2485d4bc6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CachePatch.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The type used for update operations of the Cache. + public partial class CachePatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CachePatch)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + CachePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CachePatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CachePatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCachePatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CachePatch DeserializeCachePatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + CacheUpdateProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = CacheUpdateProperties.DeserializeCacheUpdateProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CachePatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(CachePatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + CachePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CachePatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeCachePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CachePatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(CachePatch cachePatch) + { + if (cachePatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(cachePatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CachePatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CachePatch.cs new file mode 100644 index 000000000000..da987176034a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CachePatch.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The type used for update operations of the Cache. + public partial class CachePatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public CachePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal CachePatch(IDictionary tags, CacheUpdateProperties properties, IDictionary additionalBinaryDataProperties) + { + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource tags. + public IDictionary Tags { get; } + + /// The resource-specific properties for this resource. + public CacheUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProperties.Serialization.cs new file mode 100644 index 000000000000..143b47579b31 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProperties.Serialization.cs @@ -0,0 +1,509 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Cache resource properties. + public partial class CacheProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal CacheProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CacheProperties)} does not support writing '{format}' format."); + } + writer.WritePropertyName("filepath"u8); + writer.WriteStringValue(Filepath); + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size); + if (Optional.IsCollectionDefined(ExportPolicy)) + { + writer.WritePropertyName("exportPolicy"u8); + writer.WriteStartArray(); + foreach (ExportPolicyRule item in ExportPolicy) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ProtocolTypes)) + { + writer.WritePropertyName("protocolTypes"u8); + writer.WriteStartArray(); + foreach (ProtocolTypes item in ProtocolTypes) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(CacheState)) + { + writer.WritePropertyName("cacheState"u8); + writer.WriteStringValue(CacheState.Value.ToString()); + } + writer.WritePropertyName("cacheSubnetResourceId"u8); + writer.WriteStringValue(CacheSubnetResourceId); + writer.WritePropertyName("peeringSubnetResourceId"u8); + writer.WriteStringValue(PeeringSubnetResourceId); + if (options.Format != "W" && Optional.IsCollectionDefined(MountTargets)) + { + writer.WritePropertyName("mountTargets"u8); + writer.WriteStartArray(); + foreach (CacheMountTargetProperties item in MountTargets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Kerberos)) + { + writer.WritePropertyName("kerberos"u8); + writer.WriteStringValue(Kerberos.Value.ToString()); + } + if (Optional.IsDefined(SmbSettings)) + { + writer.WritePropertyName("smbSettings"u8); + writer.WriteObjectValue(SmbSettings, options); + } + if (Optional.IsDefined(ThroughputMibps)) + { + writer.WritePropertyName("throughputMibps"u8); + writer.WriteNumberValue(ThroughputMibps.Value); + } + if (options.Format != "W" && Optional.IsDefined(ActualThroughputMibps)) + { + writer.WritePropertyName("actualThroughputMibps"u8); + writer.WriteNumberValue(ActualThroughputMibps.Value); + } + writer.WritePropertyName("encryptionKeySource"u8); + writer.WriteStringValue(EncryptionKeySource.ToString()); + if (Optional.IsDefined(KeyVaultPrivateEndpointResourceId)) + { + writer.WritePropertyName("keyVaultPrivateEndpointResourceId"u8); + writer.WriteStringValue(KeyVaultPrivateEndpointResourceId); + } + if (options.Format != "W" && Optional.IsDefined(MaximumNumberOfFiles)) + { + writer.WritePropertyName("maximumNumberOfFiles"u8); + writer.WriteNumberValue(MaximumNumberOfFiles.Value); + } + if (options.Format != "W" && Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"u8); + writer.WriteStringValue(Encryption.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Language)) + { + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language.Value.ToString()); + } + if (Optional.IsDefined(Ldap)) + { + writer.WritePropertyName("ldap"u8); + writer.WriteStringValue(Ldap.Value.ToString()); + } + if (Optional.IsDefined(LdapServerType)) + { + writer.WritePropertyName("ldapServerType"u8); + writer.WriteStringValue(LdapServerType.Value.ToString()); + } + writer.WritePropertyName("originClusterInformation"u8); + writer.WriteObjectValue(OriginClusterInformation, options); + if (Optional.IsDefined(CifsChangeNotifications)) + { + writer.WritePropertyName("cifsChangeNotifications"u8); + writer.WriteStringValue(CifsChangeNotifications.Value.ToString()); + } + if (Optional.IsDefined(GlobalFileLocking)) + { + writer.WritePropertyName("globalFileLocking"u8); + writer.WriteStringValue(GlobalFileLocking.Value.ToString()); + } + if (Optional.IsDefined(WriteBack)) + { + writer.WritePropertyName("writeBack"u8); + writer.WriteStringValue(WriteBack.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + CacheProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CacheProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CacheProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCacheProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CacheProperties DeserializeCacheProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string filepath = default; + long size = default; + IList exportPolicy = default; + IList protocolTypes = default; + CacheProvisioningState? provisioningState = default; + CacheLifeCycleState? cacheState = default; + ResourceIdentifier cacheSubnetResourceId = default; + ResourceIdentifier peeringSubnetResourceId = default; + IReadOnlyList mountTargets = default; + KerberosState? kerberos = default; + SmbSettings smbSettings = default; + float? throughputMibps = default; + float? actualThroughputMibps = default; + EncryptionKeySource encryptionKeySource = default; + ResourceIdentifier keyVaultPrivateEndpointResourceId = default; + long? maximumNumberOfFiles = default; + EncryptionState? encryption = default; + VolumeLanguage? language = default; + LdapState? ldap = default; + LdapServerType? ldapServerType = default; + OriginClusterInformation originClusterInformation = default; + CifsChangeNotifyState? cifsChangeNotifications = default; + GlobalFileLockingState? globalFileLocking = default; + EnableWriteBackState? writeBack = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("filepath"u8)) + { + filepath = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("size"u8)) + { + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("exportPolicy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ExportPolicyRule.DeserializeExportPolicyRule(item, options)); + } + exportPolicy = array; + continue; + } + if (prop.NameEquals("protocolTypes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(new ProtocolTypes(item.GetString())); + } + protocolTypes = array; + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new CacheProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("cacheState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cacheState = new CacheLifeCycleState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("cacheSubnetResourceId"u8)) + { + cacheSubnetResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("peeringSubnetResourceId"u8)) + { + peeringSubnetResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("mountTargets"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(CacheMountTargetProperties.DeserializeCacheMountTargetProperties(item, options)); + } + mountTargets = array; + continue; + } + if (prop.NameEquals("kerberos"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kerberos = new KerberosState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbSettings"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbSettings = SmbSettings.DeserializeSmbSettings(prop.Value, options); + continue; + } + if (prop.NameEquals("throughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + throughputMibps = prop.Value.GetSingle(); + continue; + } + if (prop.NameEquals("actualThroughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + actualThroughputMibps = prop.Value.GetSingle(); + continue; + } + if (prop.NameEquals("encryptionKeySource"u8)) + { + encryptionKeySource = new EncryptionKeySource(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyVaultPrivateEndpointResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultPrivateEndpointResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("maximumNumberOfFiles"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maximumNumberOfFiles = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("encryption"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = new EncryptionState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("language"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + language = new VolumeLanguage(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("ldap"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ldap = new LdapState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("ldapServerType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ldapServerType = new LdapServerType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("originClusterInformation"u8)) + { + originClusterInformation = OriginClusterInformation.DeserializeOriginClusterInformation(prop.Value, options); + continue; + } + if (prop.NameEquals("cifsChangeNotifications"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cifsChangeNotifications = new CifsChangeNotifyState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("globalFileLocking"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + globalFileLocking = new GlobalFileLockingState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("writeBack"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + writeBack = new EnableWriteBackState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CacheProperties( + filepath, + size, + exportPolicy ?? new ChangeTrackingList(), + protocolTypes ?? new ChangeTrackingList(), + provisioningState, + cacheState, + cacheSubnetResourceId, + peeringSubnetResourceId, + mountTargets ?? new ChangeTrackingList(), + kerberos, + smbSettings, + throughputMibps, + actualThroughputMibps, + encryptionKeySource, + keyVaultPrivateEndpointResourceId, + maximumNumberOfFiles, + encryption, + language, + ldap, + ldapServerType, + originClusterInformation, + cifsChangeNotifications, + globalFileLocking, + writeBack, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(CacheProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + CacheProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CacheProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeCacheProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CacheProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProperties.cs new file mode 100644 index 000000000000..87651e5010a1 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProperties.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Cache resource properties. + public partial class CacheProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The file path of the cache. + /// Maximum storage quota allowed for a file system in bytes. Valid values are in the range 50GiB to 1PiB. Values expressed in bytes as multiples of 1GiB. + /// The Azure Resource URI for a delegated cache subnet that will be used to allocate data IPs. + /// The Azure Resource URI for a delegated subnet that will be used for ANF Intercluster Interface IP addresses. + /// Source of key used to encrypt data in the cache. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. + /// Origin cluster information. + /// , , or is null. + public CacheProperties(string filepath, long size, ResourceIdentifier cacheSubnetResourceId, ResourceIdentifier peeringSubnetResourceId, EncryptionKeySource encryptionKeySource, OriginClusterInformation originClusterInformation) + { + Argument.AssertNotNull(filepath, nameof(filepath)); + Argument.AssertNotNull(cacheSubnetResourceId, nameof(cacheSubnetResourceId)); + Argument.AssertNotNull(peeringSubnetResourceId, nameof(peeringSubnetResourceId)); + Argument.AssertNotNull(originClusterInformation, nameof(originClusterInformation)); + + Filepath = filepath; + Size = size; + ExportPolicy = new ChangeTrackingList(); + ProtocolTypes = new ChangeTrackingList(); + CacheSubnetResourceId = cacheSubnetResourceId; + PeeringSubnetResourceId = peeringSubnetResourceId; + MountTargets = new ChangeTrackingList(); + EncryptionKeySource = encryptionKeySource; + OriginClusterInformation = originClusterInformation; + } + + /// Initializes a new instance of . + /// The file path of the cache. + /// Maximum storage quota allowed for a file system in bytes. Valid values are in the range 50GiB to 1PiB. Values expressed in bytes as multiples of 1GiB. + /// Set of export policy rules. + /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + /// Azure lifecycle management. + /// Azure NetApp Files Cache lifecycle management. + /// The Azure Resource URI for a delegated cache subnet that will be used to allocate data IPs. + /// The Azure Resource URI for a delegated subnet that will be used for ANF Intercluster Interface IP addresses. + /// List of mount targets that can be used to mount this cache. + /// Describe if a cache is Kerberos enabled. + /// SMB information for the cache. + /// Maximum throughput in MiB/s that can be achieved by this cache volume and this will be accepted as input only for manual qosType cache. + /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. + /// Source of key used to encrypt data in the cache. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. + /// Maximum number of files allowed. + /// Specifies if the cache is encryption or not. + /// Language supported for volume. + /// Specifies whether LDAP is enabled or not for flexcache volume. + /// Specifies the type of LDAP server for flexcache volume. + /// Origin cluster information. + /// Flag indicating whether a CIFS change notification is enabled for the cache. + /// Flag indicating whether the global file lock is enabled for the cache. + /// Flag indicating whether writeback is enabled for the cache. + /// Keeps track of any properties unknown to the library. + internal CacheProperties(string filepath, long size, IList exportPolicy, IList protocolTypes, CacheProvisioningState? provisioningState, CacheLifeCycleState? cacheState, ResourceIdentifier cacheSubnetResourceId, ResourceIdentifier peeringSubnetResourceId, IReadOnlyList mountTargets, KerberosState? kerberos, SmbSettings smbSettings, float? throughputMibps, float? actualThroughputMibps, EncryptionKeySource encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, long? maximumNumberOfFiles, EncryptionState? encryption, VolumeLanguage? language, LdapState? ldap, LdapServerType? ldapServerType, OriginClusterInformation originClusterInformation, CifsChangeNotifyState? cifsChangeNotifications, GlobalFileLockingState? globalFileLocking, EnableWriteBackState? writeBack, IDictionary additionalBinaryDataProperties) + { + Filepath = filepath; + Size = size; + ExportPolicy = exportPolicy; + ProtocolTypes = protocolTypes; + ProvisioningState = provisioningState; + CacheState = cacheState; + CacheSubnetResourceId = cacheSubnetResourceId; + PeeringSubnetResourceId = peeringSubnetResourceId; + MountTargets = mountTargets; + Kerberos = kerberos; + SmbSettings = smbSettings; + ThroughputMibps = throughputMibps; + ActualThroughputMibps = actualThroughputMibps; + EncryptionKeySource = encryptionKeySource; + KeyVaultPrivateEndpointResourceId = keyVaultPrivateEndpointResourceId; + MaximumNumberOfFiles = maximumNumberOfFiles; + Encryption = encryption; + Language = language; + Ldap = ldap; + LdapServerType = ldapServerType; + OriginClusterInformation = originClusterInformation; + CifsChangeNotifications = cifsChangeNotifications; + GlobalFileLocking = globalFileLocking; + WriteBack = writeBack; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The file path of the cache. + public string Filepath { get; set; } + + /// Maximum storage quota allowed for a file system in bytes. Valid values are in the range 50GiB to 1PiB. Values expressed in bytes as multiples of 1GiB. + public long Size { get; set; } + + /// Set of export policy rules. + public IList ExportPolicy { get; } + + /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + public IList ProtocolTypes { get; } + + /// Azure lifecycle management. + public CacheProvisioningState? ProvisioningState { get; } + + /// Azure NetApp Files Cache lifecycle management. + public CacheLifeCycleState? CacheState { get; } + + /// The Azure Resource URI for a delegated cache subnet that will be used to allocate data IPs. + public ResourceIdentifier CacheSubnetResourceId { get; set; } + + /// The Azure Resource URI for a delegated subnet that will be used for ANF Intercluster Interface IP addresses. + public ResourceIdentifier PeeringSubnetResourceId { get; set; } + + /// List of mount targets that can be used to mount this cache. + public IReadOnlyList MountTargets { get; } + + /// Describe if a cache is Kerberos enabled. + public KerberosState? Kerberos { get; set; } + + /// SMB information for the cache. + public SmbSettings SmbSettings { get; set; } + + /// Maximum throughput in MiB/s that can be achieved by this cache volume and this will be accepted as input only for manual qosType cache. + public float? ThroughputMibps { get; set; } + + /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. + public float? ActualThroughputMibps { get; } + + /// Source of key used to encrypt data in the cache. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. + public EncryptionKeySource EncryptionKeySource { get; set; } + + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. + public ResourceIdentifier KeyVaultPrivateEndpointResourceId { get; set; } + + /// Maximum number of files allowed. + public long? MaximumNumberOfFiles { get; } + + /// Specifies if the cache is encryption or not. + public EncryptionState? Encryption { get; } + + /// Language supported for volume. + public VolumeLanguage? Language { get; } + + /// Specifies whether LDAP is enabled or not for flexcache volume. + public LdapState? Ldap { get; set; } + + /// Specifies the type of LDAP server for flexcache volume. + public LdapServerType? LdapServerType { get; set; } + + /// Origin cluster information. + public OriginClusterInformation OriginClusterInformation { get; set; } + + /// Flag indicating whether a CIFS change notification is enabled for the cache. + public CifsChangeNotifyState? CifsChangeNotifications { get; set; } + + /// Flag indicating whether the global file lock is enabled for the cache. + public GlobalFileLockingState? GlobalFileLocking { get; set; } + + /// Flag indicating whether writeback is enabled for the cache. + public EnableWriteBackState? WriteBack { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProvisioningState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProvisioningState.cs new file mode 100644 index 000000000000..94fb36c09c70 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheProvisioningState.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Azure lifecycle management. + public readonly partial struct CacheProvisioningState : IEquatable + { + private readonly string _value; + /// The resource is being created. + private const string CreatingValue = "Creating"; + /// The resource is being updated. + private const string UpdatingValue = "Updating"; + /// The resource is being deleted. + private const string DeletingValue = "Deleting"; + /// The resource is in a failed state. + private const string FailedValue = "Failed"; + /// The resource is succeeded. + private const string SucceededValue = "Succeeded"; + /// Resource creation was canceled. + private const string CanceledValue = "Canceled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public CacheProvisioningState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// The resource is being created. + public static CacheProvisioningState Creating { get; } = new CacheProvisioningState(CreatingValue); + + /// The resource is being updated. + public static CacheProvisioningState Updating { get; } = new CacheProvisioningState(UpdatingValue); + + /// The resource is being deleted. + public static CacheProvisioningState Deleting { get; } = new CacheProvisioningState(DeletingValue); + + /// The resource is in a failed state. + public static CacheProvisioningState Failed { get; } = new CacheProvisioningState(FailedValue); + + /// The resource is succeeded. + public static CacheProvisioningState Succeeded { get; } = new CacheProvisioningState(SucceededValue); + + /// Resource creation was canceled. + public static CacheProvisioningState Canceled { get; } = new CacheProvisioningState(CanceledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(CacheProvisioningState left, CacheProvisioningState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(CacheProvisioningState left, CacheProvisioningState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator CacheProvisioningState(string value) => new CacheProvisioningState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator CacheProvisioningState?(string value) => value == null ? null : new CacheProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CacheProvisioningState other && Equals(other); + + /// + public bool Equals(CacheProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheUpdateProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..b1c7594273fc --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheUpdateProperties.Serialization.cs @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The updatable properties of the Cache. + public partial class CacheUpdateProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CacheUpdateProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsCollectionDefined(ExportPolicy)) + { + writer.WritePropertyName("exportPolicy"u8); + writer.WriteStartArray(); + foreach (ExportPolicyRule item in ExportPolicy) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ProtocolTypes)) + { + writer.WritePropertyName("protocolTypes"u8); + writer.WriteStartArray(); + foreach (ProtocolTypes item in ProtocolTypes) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SmbSettings)) + { + writer.WritePropertyName("smbSettings"u8); + writer.WriteObjectValue(SmbSettings, options); + } + if (Optional.IsDefined(ThroughputMibps)) + { + writer.WritePropertyName("throughputMibps"u8); + writer.WriteNumberValue(ThroughputMibps.Value); + } + if (Optional.IsDefined(KeyVaultPrivateEndpointResourceId)) + { + writer.WritePropertyName("keyVaultPrivateEndpointResourceId"u8); + writer.WriteStringValue(KeyVaultPrivateEndpointResourceId); + } + if (Optional.IsDefined(CifsChangeNotifications)) + { + writer.WritePropertyName("cifsChangeNotifications"u8); + writer.WriteStringValue(CifsChangeNotifications.Value.ToString()); + } + if (Optional.IsDefined(GlobalFileLocking)) + { + writer.WritePropertyName("globalFileLocking"u8); + writer.WriteStringValue(GlobalFileLocking.Value.ToString()); + } + if (Optional.IsDefined(WriteBack)) + { + writer.WritePropertyName("writeBack"u8); + writer.WriteStringValue(WriteBack.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + CacheUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CacheUpdateProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CacheUpdateProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCacheUpdateProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CacheUpdateProperties DeserializeCacheUpdateProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? size = default; + IList exportPolicy = default; + IList protocolTypes = default; + SmbSettings smbSettings = default; + float? throughputMibps = default; + ResourceIdentifier keyVaultPrivateEndpointResourceId = default; + CifsChangeNotifyState? cifsChangeNotifications = default; + GlobalFileLockingState? globalFileLocking = default; + EnableWriteBackState? writeBack = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("size"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("exportPolicy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ExportPolicyRule.DeserializeExportPolicyRule(item, options)); + } + exportPolicy = array; + continue; + } + if (prop.NameEquals("protocolTypes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(new ProtocolTypes(item.GetString())); + } + protocolTypes = array; + continue; + } + if (prop.NameEquals("smbSettings"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbSettings = SmbSettings.DeserializeSmbSettings(prop.Value, options); + continue; + } + if (prop.NameEquals("throughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + throughputMibps = prop.Value.GetSingle(); + continue; + } + if (prop.NameEquals("keyVaultPrivateEndpointResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultPrivateEndpointResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("cifsChangeNotifications"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cifsChangeNotifications = new CifsChangeNotifyState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("globalFileLocking"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + globalFileLocking = new GlobalFileLockingState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("writeBack"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + writeBack = new EnableWriteBackState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CacheUpdateProperties( + size, + exportPolicy ?? new ChangeTrackingList(), + protocolTypes ?? new ChangeTrackingList(), + smbSettings, + throughputMibps, + keyVaultPrivateEndpointResourceId, + cifsChangeNotifications, + globalFileLocking, + writeBack, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(CacheUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + CacheUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CacheUpdateProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeCacheUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CacheUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheUpdateProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheUpdateProperties.cs new file mode 100644 index 000000000000..2e3849f2ba64 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CacheUpdateProperties.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The updatable properties of the Cache. + public partial class CacheUpdateProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public CacheUpdateProperties() + { + ExportPolicy = new ChangeTrackingList(); + ProtocolTypes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Maximum storage quota allowed for a file system in bytes. Valid values are in the range 50GiB to 1PiB. Values expressed in bytes as multiples of 1GiB. + /// Set of export policy rules. + /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + /// SMB information for the cache. + /// Maximum throughput in MiB/s that can be achieved by this cache volume and this will be accepted as input only for manual qosType cache. + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. + /// Flag indicating whether a CIFS change notification is enabled for the cache. + /// Flag indicating whether the global file lock is enabled for the cache. + /// Flag indicating whether writeback is enabled for the cache. + /// Keeps track of any properties unknown to the library. + internal CacheUpdateProperties(long? size, IList exportPolicy, IList protocolTypes, SmbSettings smbSettings, float? throughputMibps, ResourceIdentifier keyVaultPrivateEndpointResourceId, CifsChangeNotifyState? cifsChangeNotifications, GlobalFileLockingState? globalFileLocking, EnableWriteBackState? writeBack, IDictionary additionalBinaryDataProperties) + { + Size = size; + ExportPolicy = exportPolicy; + ProtocolTypes = protocolTypes; + SmbSettings = smbSettings; + ThroughputMibps = throughputMibps; + KeyVaultPrivateEndpointResourceId = keyVaultPrivateEndpointResourceId; + CifsChangeNotifications = cifsChangeNotifications; + GlobalFileLocking = globalFileLocking; + WriteBack = writeBack; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Maximum storage quota allowed for a file system in bytes. Valid values are in the range 50GiB to 1PiB. Values expressed in bytes as multiples of 1GiB. + public long? Size { get; set; } + + /// Set of export policy rules. + public IList ExportPolicy { get; } + + /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + public IList ProtocolTypes { get; } + + /// SMB information for the cache. + public SmbSettings SmbSettings { get; set; } + + /// Maximum throughput in MiB/s that can be achieved by this cache volume and this will be accepted as input only for manual qosType cache. + public float? ThroughputMibps { get; set; } + + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. + public ResourceIdentifier KeyVaultPrivateEndpointResourceId { get; set; } + + /// Flag indicating whether a CIFS change notification is enabled for the cache. + public CifsChangeNotifyState? CifsChangeNotifications { get; set; } + + /// Flag indicating whether the global file lock is enabled for the cache. + public GlobalFileLockingState? GlobalFileLocking { get; set; } + + /// Flag indicating whether writeback is enabled for the cache. + public EnableWriteBackState? WriteBack { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolEncryptionType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolEncryptionType.cs index b1b843a4398e..6226d534a046 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolEncryptionType.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolEncryptionType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct CapacityPoolEncryptionType : IEquatable { private readonly string _value; + /// EncryptionType Single, volumes will use single encryption at rest. + private const string SingleValue = "Single"; + /// EncryptionType Double, volumes will use double encryption at rest. + private const string DoubleValue = "Double"; /// Initializes a new instance of . + /// The value. /// is null. public CapacityPoolEncryptionType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string SingleValue = "Single"; - private const string DoubleValue = "Double"; + _value = value; + } /// EncryptionType Single, volumes will use single encryption at rest. public static CapacityPoolEncryptionType Single { get; } = new CapacityPoolEncryptionType(SingleValue); + /// EncryptionType Double, volumes will use double encryption at rest. public static CapacityPoolEncryptionType Double { get; } = new CapacityPoolEncryptionType(DoubleValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(CapacityPoolEncryptionType left, CapacityPoolEncryptionType right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(CapacityPoolEncryptionType left, CapacityPoolEncryptionType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator CapacityPoolEncryptionType(string value) => new CapacityPoolEncryptionType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator CapacityPoolEncryptionType?(string value) => value == null ? null : new CapacityPoolEncryptionType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is CapacityPoolEncryptionType other && Equals(other); - /// + + /// public bool Equals(CapacityPoolEncryptionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolList.Serialization.cs index f6a6f2b58aff..3ed35828d34c 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class CapacityPoolList : IUtf8JsonSerializable, IJsonModel + /// List of capacity pool resources. + internal partial class CapacityPoolList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal CapacityPoolList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CapacityPoolList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (CapacityPoolData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CapacityPoolList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + CapacityPoolList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CapacityPoolList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CapacityPoolList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeCapacityPoolList(document.RootElement, options); } - internal static CapacityPoolList DeserializeCapacityPoolList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CapacityPoolList DeserializeCapacityPoolList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(CapacityPoolData.DeserializeCapacityPoolData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new CapacityPoolList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new CapacityPoolList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -133,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op } } - CapacityPoolList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + CapacityPoolList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CapacityPoolList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeCapacityPoolList(document.RootElement, options); } default: @@ -149,6 +163,15 @@ CapacityPoolList IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static CapacityPoolList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeCapacityPoolList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolList.cs index 64c1fb0af9d2..64ccd8da4159 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of capacity pool resources. internal partial class CapacityPoolList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal CapacityPoolList() + /// The CapacityPool items on this page. + internal CapacityPoolList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// List of Capacity pools. - /// URL to get the next set of results. - /// Keeps track of any properties unknown to the library. - internal CapacityPoolList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The CapacityPool items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal CapacityPoolList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// List of Capacity pools. - public IReadOnlyList Value { get; } - /// URL to get the next set of results. - public string NextLink { get; } + /// The CapacityPool items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolPatch.Serialization.cs index d66d2bc53776..953a88ac62e7 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolPatch.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolPatch.Serialization.cs @@ -8,17 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class CapacityPoolPatch : IUtf8JsonSerializable, IJsonModel + /// Capacity pool patch resource. + public partial class CapacityPoolPatch : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,197 +28,177 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The JSON writer. /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CapacityPoolPatch)} does not support writing '{format}' format."); } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Size)) + if (Optional.IsDefined(Location)) { - writer.WritePropertyName("size"u8); - writer.WriteNumberValue(Size.Value); + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); } - if (Optional.IsDefined(QosType)) + if (options.Format != "W" && Optional.IsDefined(Id)) { - writer.WritePropertyName("qosType"u8); - writer.WriteStringValue(QosType.Value.ToString()); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); } - if (Optional.IsDefined(IsCoolAccessEnabled)) + if (options.Format != "W" && Optional.IsDefined(Name)) { - writer.WritePropertyName("coolAccess"u8); - writer.WriteBooleanValue(IsCoolAccessEnabled.Value); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); } - if (Optional.IsDefined(CustomThroughputMibps)) + if (options.Format != "W" && Optional.IsDefined(Type)) { - if (CustomThroughputMibps != null) + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WritePropertyName("customThroughputMibps"u8); - writer.WriteNumberValue(CustomThroughputMibps.Value); + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); } - else + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) { - writer.WriteNull("customThroughputMibps"); + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif } } - writer.WriteEndObject(); } - CapacityPoolPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + CapacityPoolPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CapacityPoolPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CapacityPoolPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeCapacityPoolPatch(document.RootElement, options); } - internal static CapacityPoolPatch DeserializeCapacityPoolPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CapacityPoolPatch DeserializeCapacityPoolPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; + string location = default; + string id = default; string name = default; - ResourceType type = default; - SystemData systemData = default; - long? size = default; - CapacityPoolQosType? qosType = default; - bool? coolAccess = default; - float? customThroughputMibps = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + string @type = default; + IDictionary tags = default; + PoolPatchProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("location"u8)) { - location = new AzureLocation(property.Value.GetString()); + location = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + id = prop.Value.GetString(); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("type"u8)) { - type = new ResourceType(property.Value.GetString()); + @type = prop.Value.GetString(); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("size"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - size = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("qosType"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - qosType = new CapacityPoolQosType(property0.Value.GetString()); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("coolAccess"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccess = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("customThroughputMibps"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - customThroughputMibps = null; - continue; - } - customThroughputMibps = property0.Value.GetSingle(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PoolPatchProperties.DeserializePoolPatchProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new CapacityPoolPatch( + location, id, name, - type, - systemData, + @type, tags ?? new ChangeTrackingDictionary(), - location, - size, - qosType, - coolAccess, - customThroughputMibps, - serializedAdditionalRawData); + properties, + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -228,15 +208,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - CapacityPoolPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + CapacityPoolPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CapacityPoolPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeCapacityPoolPatch(document.RootElement, options); } default: @@ -244,6 +229,19 @@ CapacityPoolPatch IPersistableModel.Create(BinaryData data, M } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(CapacityPoolPatch capacityPoolPatch) + { + if (capacityPoolPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(capacityPoolPatch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolPatch.cs index bc3cb36a7404..08d9cb1901d4 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolPatch.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolPatch.cs @@ -7,85 +7,125 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Capacity pool patch resource. - public partial class CapacityPoolPatch : TrackedResourceData + public partial class CapacityPoolPatch { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. - public CapacityPoolPatch(AzureLocation location) : base(location) + public CapacityPoolPatch() { + Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). - /// The qos type of the pool. - /// If enabled (true) the pool can contain cool Access enabled volumes. - /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. - /// Keeps track of any properties unknown to the library. - internal CapacityPoolPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, long? size, CapacityPoolQosType? qosType, bool? isCoolAccessEnabled, float? customThroughputMibps, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// Capacity pool properties. + /// Keeps track of any properties unknown to the library. + internal CapacityPoolPatch(string location, string id, string name, string @type, IDictionary tags, PoolPatchProperties properties, IDictionary additionalBinaryDataProperties) { - Size = size; - QosType = qosType; - IsCoolAccessEnabled = isCoolAccessEnabled; - CustomThroughputMibps = customThroughputMibps; - _serializedAdditionalRawData = serializedAdditionalRawData; + Location = location; + Id = id; + Name = name; + Type = @type; + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Initializes a new instance of for deserialization. - internal CapacityPoolPatch() + /// Resource location. + public string Location { get; set; } + + /// Resource Id. + public string Id { get; } + + /// Resource name. + public string Name { get; } + + /// Resource type. + public string Type { get; } + + /// Resource tags. + public IDictionary Tags { get; } + + /// Capacity pool properties. + internal PoolPatchProperties Properties { get; set; } + + /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). + public long? Size { + get + { + return Properties is null ? default : Properties.Size; + } + set + { + if (Properties is null) + { + Properties = new PoolPatchProperties(); + } + Properties.Size = value.Value; + } } - /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). - public long? Size { get; set; } /// The qos type of the pool. - public CapacityPoolQosType? QosType { get; set; } + public QosType? QosType + { + get + { + return Properties is null ? default : Properties.QosType; + } + set + { + if (Properties is null) + { + Properties = new PoolPatchProperties(); + } + Properties.QosType = value.Value; + } + } + /// If enabled (true) the pool can contain cool Access enabled volumes. - public bool? IsCoolAccessEnabled { get; set; } + public bool? CoolAccess + { + get + { + return Properties is null ? default : Properties.CoolAccess; + } + set + { + if (Properties is null) + { + Properties = new PoolPatchProperties(); + } + Properties.CoolAccess = value.Value; + } + } + /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. - public float? CustomThroughputMibps { get; set; } + public int? CustomThroughputMibpsInt + { + get + { + return Properties is null ? default : Properties.CustomThroughputMibpsInt; + } + set + { + if (Properties is null) + { + Properties = new PoolPatchProperties(); + } + Properties.CustomThroughputMibpsInt = value.Value; + } + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolQosType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolQosType.cs deleted file mode 100644 index 71994c7bcda3..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CapacityPoolQosType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// The qos type of the pool. - public readonly partial struct CapacityPoolQosType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public CapacityPoolQosType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AutoValue = "Auto"; - private const string ManualValue = "Manual"; - - /// qos type Auto. - public static CapacityPoolQosType Auto { get; } = new CapacityPoolQosType(AutoValue); - /// qos type Manual. - public static CapacityPoolQosType Manual { get; } = new CapacityPoolQosType(ManualValue); - /// Determines if two values are the same. - public static bool operator ==(CapacityPoolQosType left, CapacityPoolQosType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(CapacityPoolQosType left, CapacityPoolQosType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator CapacityPoolQosType(string value) => new CapacityPoolQosType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is CapacityPoolQosType other && Equals(other); - /// - public bool Equals(CapacityPoolQosType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeKeyVault.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeKeyVault.Serialization.cs new file mode 100644 index 000000000000..a03f494ccbfb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeKeyVault.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Change key vault request. + public partial class ChangeKeyVault : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ChangeKeyVault() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ChangeKeyVault)} does not support writing '{format}' format."); + } + writer.WritePropertyName("keyVaultUri"u8); + writer.WriteStringValue(KeyVaultUri.AbsoluteUri); + writer.WritePropertyName("keyName"u8); + writer.WriteStringValue(KeyName); + if (Optional.IsDefined(KeyVaultResourceId)) + { + writer.WritePropertyName("keyVaultResourceId"u8); + writer.WriteStringValue(KeyVaultResourceId); + } + writer.WritePropertyName("keyVaultPrivateEndpoints"u8); + writer.WriteStartArray(); + foreach (KeyVaultPrivateEndpoint item in KeyVaultPrivateEndpoints) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ChangeKeyVault IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ChangeKeyVault JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ChangeKeyVault)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeChangeKeyVault(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ChangeKeyVault DeserializeChangeKeyVault(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri keyVaultUri = default; + string keyName = default; + ResourceIdentifier keyVaultResourceId = default; + IList keyVaultPrivateEndpoints = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("keyVaultUri"u8)) + { + keyVaultUri = new Uri(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyName"u8)) + { + keyName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("keyVaultResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyVaultPrivateEndpoints"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(KeyVaultPrivateEndpoint.DeserializeKeyVaultPrivateEndpoint(item, options)); + } + keyVaultPrivateEndpoints = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ChangeKeyVault(keyVaultUri, keyName, keyVaultResourceId, keyVaultPrivateEndpoints, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ChangeKeyVault)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ChangeKeyVault IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ChangeKeyVault PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeChangeKeyVault(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ChangeKeyVault)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ChangeKeyVault changeKeyVault) + { + if (changeKeyVault == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(changeKeyVault, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChangeKeyVault.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeKeyVault.cs similarity index 53% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChangeKeyVault.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeKeyVault.cs index e3bdfad1ab63..e502df32d64f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChangeKeyVault.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeKeyVault.cs @@ -9,50 +9,22 @@ using System.Collections.Generic; using System.Linq; using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Change key vault request. - public partial class NetAppChangeKeyVault + public partial class ChangeKeyVault { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The URI of the key vault/managed HSM that should be used for encryption. /// The name of the key that should be used for encryption. /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. /// , or is null. - public NetAppChangeKeyVault(Uri keyVaultUri, string keyName, IEnumerable keyVaultPrivateEndpoints) + public ChangeKeyVault(Uri keyVaultUri, string keyName, IEnumerable keyVaultPrivateEndpoints) { Argument.AssertNotNull(keyVaultUri, nameof(keyVaultUri)); Argument.AssertNotNull(keyName, nameof(keyName)); @@ -63,33 +35,31 @@ public NetAppChangeKeyVault(Uri keyVaultUri, string keyName, IEnumerable Initializes a new instance of . + /// Initializes a new instance of . /// The URI of the key vault/managed HSM that should be used for encryption. /// The name of the key that should be used for encryption. /// Azure resource ID of the key vault/managed HSM that should be used for encryption. /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. - /// Keeps track of any properties unknown to the library. - internal NetAppChangeKeyVault(Uri keyVaultUri, string keyName, ResourceIdentifier keyVaultResourceId, IList keyVaultPrivateEndpoints, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ChangeKeyVault(Uri keyVaultUri, string keyName, ResourceIdentifier keyVaultResourceId, IList keyVaultPrivateEndpoints, IDictionary additionalBinaryDataProperties) { KeyVaultUri = keyVaultUri; KeyName = keyName; KeyVaultResourceId = keyVaultResourceId; KeyVaultPrivateEndpoints = keyVaultPrivateEndpoints; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppChangeKeyVault() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The URI of the key vault/managed HSM that should be used for encryption. public Uri KeyVaultUri { get; } + /// The name of the key that should be used for encryption. public string KeyName { get; } + /// Azure resource ID of the key vault/managed HSM that should be used for encryption. public ResourceIdentifier KeyVaultResourceId { get; set; } + /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. - public IList KeyVaultPrivateEndpoints { get; } + public IList KeyVaultPrivateEndpoints { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeZoneRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeZoneRequest.Serialization.cs new file mode 100644 index 000000000000..a60fe0a002c4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeZoneRequest.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Changes the zone for the Zone Redundant elastic capacity pool. + public partial class ChangeZoneRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ChangeZoneRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ChangeZoneRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("newZone"u8); + writer.WriteStringValue(NewZone); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ChangeZoneRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ChangeZoneRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ChangeZoneRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeChangeZoneRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ChangeZoneRequest DeserializeChangeZoneRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string newZone = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("newZone"u8)) + { + newZone = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ChangeZoneRequest(newZone, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ChangeZoneRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ChangeZoneRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ChangeZoneRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeChangeZoneRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ChangeZoneRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ChangeZoneRequest changeZoneRequest) + { + if (changeZoneRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(changeZoneRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeZoneRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeZoneRequest.cs new file mode 100644 index 000000000000..028aa70076f3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChangeZoneRequest.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Changes the zone for the Zone Redundant elastic capacity pool. + public partial class ChangeZoneRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Availability zone to move Zone Redundant elastic capacity pool to. + /// is null. + public ChangeZoneRequest(string newZone) + { + Argument.AssertNotNull(newZone, nameof(newZone)); + + NewZone = newZone; + } + + /// Initializes a new instance of . + /// Availability zone to move Zone Redundant elastic capacity pool to. + /// Keeps track of any properties unknown to the library. + internal ChangeZoneRequest(string newZone, IDictionary additionalBinaryDataProperties) + { + NewZone = newZone; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Availability zone to move Zone Redundant elastic capacity pool to. + public string NewZone { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckAvailabilityResponse.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckAvailabilityResponse.Serialization.cs new file mode 100644 index 000000000000..cda975feff1e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckAvailabilityResponse.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Information regarding availability of a resource. + public partial class CheckAvailabilityResponse : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CheckAvailabilityResponse)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(IsAvailable)) + { + writer.WritePropertyName("isAvailable"u8); + writer.WriteBooleanValue(IsAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + CheckAvailabilityResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CheckAvailabilityResponse JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CheckAvailabilityResponse)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCheckAvailabilityResponse(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CheckAvailabilityResponse DeserializeCheckAvailabilityResponse(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? isAvailable = default; + InAvailabilityReasonType? reason = default; + string message = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("isAvailable"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isAvailable = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("reason"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reason = new InAvailabilityReasonType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("message"u8)) + { + message = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CheckAvailabilityResponse(isAvailable, reason, message, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(CheckAvailabilityResponse)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + CheckAvailabilityResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CheckAvailabilityResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeCheckAvailabilityResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CheckAvailabilityResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static CheckAvailabilityResponse FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeCheckAvailabilityResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppCheckAvailabilityResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckAvailabilityResponse.cs similarity index 50% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppCheckAvailabilityResult.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckAvailabilityResponse.cs index 5f0f8e0bf81b..c01b05586e8f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppCheckAvailabilityResult.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckAvailabilityResponse.cs @@ -11,62 +11,35 @@ namespace Azure.ResourceManager.NetApp.Models { /// Information regarding availability of a resource. - public partial class NetAppCheckAvailabilityResult + public partial class CheckAvailabilityResponse { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; - /// Initializes a new instance of . - internal NetAppCheckAvailabilityResult() + /// Initializes a new instance of . + internal CheckAvailabilityResponse() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// <code>true</code> indicates name is valid and available. <code>false</code> indicates the name is invalid, unavailable, or both. /// <code>Invalid</code> indicates the name provided does not match Azure App Service naming requirements. <code>AlreadyExists</code> indicates that the name is already in use and is therefore unavailable. /// If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. - /// Keeps track of any properties unknown to the library. - internal NetAppCheckAvailabilityResult(bool? isAvailable, NetAppNameUnavailableReason? reason, string message, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal CheckAvailabilityResponse(bool? isAvailable, InAvailabilityReasonType? reason, string message, IDictionary additionalBinaryDataProperties) { IsAvailable = isAvailable; Reason = reason; Message = message; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// <code>true</code> indicates name is valid and available. <code>false</code> indicates the name is invalid, unavailable, or both. public bool? IsAvailable { get; } + /// <code>Invalid</code> indicates the name provided does not match Azure App Service naming requirements. <code>AlreadyExists</code> indicates that the name is already in use and is therefore unavailable. - public NetAppNameUnavailableReason? Reason { get; } + public InAvailabilityReasonType? Reason { get; } + /// If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. public string Message { get; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityReason.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityReason.cs new file mode 100644 index 000000000000..d08419fc08ff --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityReason.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Availability reason. + public readonly partial struct CheckElasticResourceAvailabilityReason : IEquatable + { + private readonly string _value; + /// Value indicating the name provided does not match Azure NetApp Files naming requirements. + private const string InvalidValue = "Invalid"; + /// Value indicating the name is already in use and is therefore unavailable. + private const string AlreadyExistsValue = "AlreadyExists"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public CheckElasticResourceAvailabilityReason(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Value indicating the name provided does not match Azure NetApp Files naming requirements. + public static CheckElasticResourceAvailabilityReason Invalid { get; } = new CheckElasticResourceAvailabilityReason(InvalidValue); + + /// Value indicating the name is already in use and is therefore unavailable. + public static CheckElasticResourceAvailabilityReason AlreadyExists { get; } = new CheckElasticResourceAvailabilityReason(AlreadyExistsValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(CheckElasticResourceAvailabilityReason left, CheckElasticResourceAvailabilityReason right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(CheckElasticResourceAvailabilityReason left, CheckElasticResourceAvailabilityReason right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator CheckElasticResourceAvailabilityReason(string value) => new CheckElasticResourceAvailabilityReason(value); + + /// Converts a string to a . + /// The value. + public static implicit operator CheckElasticResourceAvailabilityReason?(string value) => value == null ? null : new CheckElasticResourceAvailabilityReason(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CheckElasticResourceAvailabilityReason other && Equals(other); + + /// + public bool Equals(CheckElasticResourceAvailabilityReason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityResult.Serialization.cs new file mode 100644 index 000000000000..fb15370205b6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityResult.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Information regarding availability of a resource. + public partial class CheckElasticResourceAvailabilityResult : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CheckElasticResourceAvailabilityResult)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(IsAvailable)) + { + writer.WritePropertyName("isAvailable"u8); + writer.WriteStringValue(IsAvailable.Value.ToString()); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + CheckElasticResourceAvailabilityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CheckElasticResourceAvailabilityResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CheckElasticResourceAvailabilityResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCheckElasticResourceAvailabilityResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CheckElasticResourceAvailabilityResult DeserializeCheckElasticResourceAvailabilityResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CheckElasticResourceAvailabilityStatus? isAvailable = default; + CheckElasticResourceAvailabilityReason? reason = default; + string message = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("isAvailable"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isAvailable = new CheckElasticResourceAvailabilityStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("reason"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reason = new CheckElasticResourceAvailabilityReason(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("message"u8)) + { + message = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CheckElasticResourceAvailabilityResult(isAvailable, reason, message, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(CheckElasticResourceAvailabilityResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + CheckElasticResourceAvailabilityResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CheckElasticResourceAvailabilityResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeCheckElasticResourceAvailabilityResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CheckElasticResourceAvailabilityResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static CheckElasticResourceAvailabilityResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeCheckElasticResourceAvailabilityResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityResult.cs new file mode 100644 index 000000000000..4e8195c91eda --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityResult.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Information regarding availability of a resource. + public partial class CheckElasticResourceAvailabilityResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal CheckElasticResourceAvailabilityResult() + { + } + + /// Initializes a new instance of . + /// True indicates name is valid and available. False indicates the name is invalid, unavailable, or both. + /// Invalid indicates the name provided does not match Azure NetApp Files naming requirements. AlreadyExists indicates that the name is already in use and is therefore unavailable. + /// If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. + /// Keeps track of any properties unknown to the library. + internal CheckElasticResourceAvailabilityResult(CheckElasticResourceAvailabilityStatus? isAvailable, CheckElasticResourceAvailabilityReason? reason, string message, IDictionary additionalBinaryDataProperties) + { + IsAvailable = isAvailable; + Reason = reason; + Message = message; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// True indicates name is valid and available. False indicates the name is invalid, unavailable, or both. + public CheckElasticResourceAvailabilityStatus? IsAvailable { get; } + + /// Invalid indicates the name provided does not match Azure NetApp Files naming requirements. AlreadyExists indicates that the name is already in use and is therefore unavailable. + public CheckElasticResourceAvailabilityReason? Reason { get; } + + /// If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. + public string Message { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityStatus.cs new file mode 100644 index 000000000000..91a60af57316 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticResourceAvailabilityStatus.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Availability status. + public readonly partial struct CheckElasticResourceAvailabilityStatus : IEquatable + { + private readonly string _value; + /// Value indicating the name is valid and available. + private const string TrueValue = "True"; + /// Value indicating the the name is invalid, unavailable, or both. + private const string FalseValue = "False"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public CheckElasticResourceAvailabilityStatus(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Value indicating the name is valid and available. + public static CheckElasticResourceAvailabilityStatus True { get; } = new CheckElasticResourceAvailabilityStatus(TrueValue); + + /// Value indicating the the name is invalid, unavailable, or both. + public static CheckElasticResourceAvailabilityStatus False { get; } = new CheckElasticResourceAvailabilityStatus(FalseValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(CheckElasticResourceAvailabilityStatus left, CheckElasticResourceAvailabilityStatus right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(CheckElasticResourceAvailabilityStatus left, CheckElasticResourceAvailabilityStatus right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator CheckElasticResourceAvailabilityStatus(string value) => new CheckElasticResourceAvailabilityStatus(value); + + /// Converts a string to a . + /// The value. + public static implicit operator CheckElasticResourceAvailabilityStatus?(string value) => value == null ? null : new CheckElasticResourceAvailabilityStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CheckElasticResourceAvailabilityStatus other && Equals(other); + + /// + public bool Equals(CheckElasticResourceAvailabilityStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticVolumeFilePathAvailabilityRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticVolumeFilePathAvailabilityRequest.Serialization.cs new file mode 100644 index 000000000000..c579903d7f8c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticVolumeFilePathAvailabilityRequest.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// File path availability request content - availability is based on the elastic volume filePath within the given elastic capacityPool. + public partial class CheckElasticVolumeFilePathAvailabilityRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal CheckElasticVolumeFilePathAvailabilityRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CheckElasticVolumeFilePathAvailabilityRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("filePath"u8); + writer.WriteStringValue(FilePath); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + CheckElasticVolumeFilePathAvailabilityRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CheckElasticVolumeFilePathAvailabilityRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CheckElasticVolumeFilePathAvailabilityRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCheckElasticVolumeFilePathAvailabilityRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CheckElasticVolumeFilePathAvailabilityRequest DeserializeCheckElasticVolumeFilePathAvailabilityRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string filePath = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("filePath"u8)) + { + filePath = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CheckElasticVolumeFilePathAvailabilityRequest(filePath, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(CheckElasticVolumeFilePathAvailabilityRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + CheckElasticVolumeFilePathAvailabilityRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CheckElasticVolumeFilePathAvailabilityRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeCheckElasticVolumeFilePathAvailabilityRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CheckElasticVolumeFilePathAvailabilityRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(CheckElasticVolumeFilePathAvailabilityRequest checkElasticVolumeFilePathAvailabilityRequest) + { + if (checkElasticVolumeFilePathAvailabilityRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(checkElasticVolumeFilePathAvailabilityRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticVolumeFilePathAvailabilityRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticVolumeFilePathAvailabilityRequest.cs new file mode 100644 index 000000000000..44ab8eb9c19c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckElasticVolumeFilePathAvailabilityRequest.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// File path availability request content - availability is based on the elastic volume filePath within the given elastic capacityPool. + public partial class CheckElasticVolumeFilePathAvailabilityRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// A unique file path for the volume. Used when creating mount targets. This needs to be unique within the elastic capacity pool. + /// is null. + public CheckElasticVolumeFilePathAvailabilityRequest(string filePath) + { + Argument.AssertNotNull(filePath, nameof(filePath)); + + FilePath = filePath; + } + + /// Initializes a new instance of . + /// A unique file path for the volume. Used when creating mount targets. This needs to be unique within the elastic capacity pool. + /// Keeps track of any properties unknown to the library. + internal CheckElasticVolumeFilePathAvailabilityRequest(string filePath, IDictionary additionalBinaryDataProperties) + { + FilePath = filePath; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// A unique file path for the volume. Used when creating mount targets. This needs to be unique within the elastic capacity pool. + public string FilePath { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckNameResourceTypes.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckNameResourceTypes.cs new file mode 100644 index 000000000000..c82c2b7589a2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckNameResourceTypes.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Resource type used for verification. + public readonly partial struct CheckNameResourceTypes : IEquatable + { + private readonly string _value; + private const string MicrosoftNetAppNetAppAccountsValue = "Microsoft.NetApp/netAppAccounts"; + private const string MicrosoftNetAppNetAppAccountsCapacityPoolsValue = "Microsoft.NetApp/netAppAccounts/capacityPools"; + private const string MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesValue = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes"; + private const string MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshotsValue = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots"; + /// ANF Backup under a volume , deprecated, use `Microsoft.NetApp/netAppAccounts/backupVaults/backups` instead. + private const string MicrosoftNetAppNetAppAccountsBackupVaultsBackupsValue = "Microsoft.NetApp/netAppAccounts/backupVaults/backups"; + /// ANF Backup under a Backup Vault. + private const string MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesBackupsValue = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/backups"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public CheckNameResourceTypes(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the MicrosoftNetAppNetAppAccounts. + public static CheckNameResourceTypes MicrosoftNetAppNetAppAccounts { get; } = new CheckNameResourceTypes(MicrosoftNetAppNetAppAccountsValue); + + /// Gets the MicrosoftNetAppNetAppAccountsCapacityPools. + public static CheckNameResourceTypes MicrosoftNetAppNetAppAccountsCapacityPools { get; } = new CheckNameResourceTypes(MicrosoftNetAppNetAppAccountsCapacityPoolsValue); + + /// Gets the MicrosoftNetAppNetAppAccountsCapacityPoolsVolumes. + public static CheckNameResourceTypes MicrosoftNetAppNetAppAccountsCapacityPoolsVolumes { get; } = new CheckNameResourceTypes(MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesValue); + + /// Gets the MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots. + public static CheckNameResourceTypes MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots { get; } = new CheckNameResourceTypes(MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshotsValue); + + /// ANF Backup under a volume , deprecated, use `Microsoft.NetApp/netAppAccounts/backupVaults/backups` instead. + public static CheckNameResourceTypes MicrosoftNetAppNetAppAccountsBackupVaultsBackups { get; } = new CheckNameResourceTypes(MicrosoftNetAppNetAppAccountsBackupVaultsBackupsValue); + + /// ANF Backup under a Backup Vault. + public static CheckNameResourceTypes MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesBackups { get; } = new CheckNameResourceTypes(MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesBackupsValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(CheckNameResourceTypes left, CheckNameResourceTypes right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(CheckNameResourceTypes left, CheckNameResourceTypes right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator CheckNameResourceTypes(string value) => new CheckNameResourceTypes(value); + + /// Converts a string to a . + /// The value. + public static implicit operator CheckNameResourceTypes?(string value) => value == null ? null : new CheckNameResourceTypes(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CheckNameResourceTypes other && Equals(other); + + /// + public bool Equals(CheckNameResourceTypes other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckQuotaNameResourceTypes.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckQuotaNameResourceTypes.cs new file mode 100644 index 000000000000..3882099a065a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CheckQuotaNameResourceTypes.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Resource type used for verification. + public readonly partial struct CheckQuotaNameResourceTypes : IEquatable + { + private readonly string _value; + private const string MicrosoftNetAppNetAppAccountsValue = "Microsoft.NetApp/netAppAccounts"; + private const string MicrosoftNetAppNetAppAccountsCapacityPoolsValue = "Microsoft.NetApp/netAppAccounts/capacityPools"; + private const string MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesValue = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes"; + private const string MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshotsValue = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots"; + /// ANF Backup under a volume , deprecated, use `Microsoft.NetApp/netAppAccounts/backupVaults/backups` instead. + private const string MicrosoftNetAppNetAppAccountsBackupVaultsBackupsValue = "Microsoft.NetApp/netAppAccounts/backupVaults/backups"; + /// ANF Backup under a Backup Vault. + private const string MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesBackupsValue = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/backups"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public CheckQuotaNameResourceTypes(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the MicrosoftNetAppNetAppAccounts. + public static CheckQuotaNameResourceTypes MicrosoftNetAppNetAppAccounts { get; } = new CheckQuotaNameResourceTypes(MicrosoftNetAppNetAppAccountsValue); + + /// Gets the MicrosoftNetAppNetAppAccountsCapacityPools. + public static CheckQuotaNameResourceTypes MicrosoftNetAppNetAppAccountsCapacityPools { get; } = new CheckQuotaNameResourceTypes(MicrosoftNetAppNetAppAccountsCapacityPoolsValue); + + /// Gets the MicrosoftNetAppNetAppAccountsCapacityPoolsVolumes. + public static CheckQuotaNameResourceTypes MicrosoftNetAppNetAppAccountsCapacityPoolsVolumes { get; } = new CheckQuotaNameResourceTypes(MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesValue); + + /// Gets the MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots. + public static CheckQuotaNameResourceTypes MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots { get; } = new CheckQuotaNameResourceTypes(MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshotsValue); + + /// ANF Backup under a volume , deprecated, use `Microsoft.NetApp/netAppAccounts/backupVaults/backups` instead. + public static CheckQuotaNameResourceTypes MicrosoftNetAppNetAppAccountsBackupVaultsBackups { get; } = new CheckQuotaNameResourceTypes(MicrosoftNetAppNetAppAccountsBackupVaultsBackupsValue); + + /// ANF Backup under a Backup Vault. + public static CheckQuotaNameResourceTypes MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesBackups { get; } = new CheckQuotaNameResourceTypes(MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesBackupsValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(CheckQuotaNameResourceTypes left, CheckQuotaNameResourceTypes right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(CheckQuotaNameResourceTypes left, CheckQuotaNameResourceTypes right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator CheckQuotaNameResourceTypes(string value) => new CheckQuotaNameResourceTypes(value); + + /// Converts a string to a . + /// The value. + public static implicit operator CheckQuotaNameResourceTypes?(string value) => value == null ? null : new CheckQuotaNameResourceTypes(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CheckQuotaNameResourceTypes other && Equals(other); + + /// + public bool Equals(CheckQuotaNameResourceTypes other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChownMode.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChownMode.cs new file mode 100644 index 000000000000..3ca872e103dd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ChownMode.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root users can change ownership of files that they own. + public readonly partial struct ChownMode : IEquatable + { + private readonly string _value; + private const string RestrictedValue = "Restricted"; + private const string UnrestrictedValue = "Unrestricted"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ChownMode(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Restricted. + public static ChownMode Restricted { get; } = new ChownMode(RestrictedValue); + + /// Gets the Unrestricted. + public static ChownMode Unrestricted { get; } = new ChownMode(UnrestrictedValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ChownMode left, ChownMode right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ChownMode left, ChownMode right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ChownMode(string value) => new ChownMode(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ChownMode?(string value) => value == null ? null : new ChownMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ChownMode other && Equals(other); + + /// + public bool Equals(ChownMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsChangeNotifyState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsChangeNotifyState.cs new file mode 100644 index 000000000000..5396d00c2d3f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsChangeNotifyState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Flag indicating whether a CIFS change notification is enabled for the cache. + public readonly partial struct CifsChangeNotifyState : IEquatable + { + private readonly string _value; + /// CIFS change notification is disabled. + private const string DisabledValue = "Disabled"; + /// CIFS change notification is enabled. + private const string EnabledValue = "Enabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public CifsChangeNotifyState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// CIFS change notification is disabled. + public static CifsChangeNotifyState Disabled { get; } = new CifsChangeNotifyState(DisabledValue); + + /// CIFS change notification is enabled. + public static CifsChangeNotifyState Enabled { get; } = new CifsChangeNotifyState(EnabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(CifsChangeNotifyState left, CifsChangeNotifyState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(CifsChangeNotifyState left, CifsChangeNotifyState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator CifsChangeNotifyState(string value) => new CifsChangeNotifyState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator CifsChangeNotifyState?(string value) => value == null ? null : new CifsChangeNotifyState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CifsChangeNotifyState other && Equals(other); + + /// + public bool Equals(CifsChangeNotifyState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsUser.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsUser.Serialization.cs index 1108a82ec8c6..c77f978db4ec 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsUser.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsUser.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class CifsUser : IUtf8JsonSerializable, IJsonModel + /// The effective CIFS username when accessing the volume data. + internal partial class CifsUser : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +29,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CifsUser)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Username)) { writer.WritePropertyName("username"u8); writer.WriteStringValue(Username); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -56,49 +56,55 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CifsUser IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + CifsUser IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CifsUser JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CifsUser)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeCifsUser(document.RootElement, options); } - internal static CifsUser DeserializeCifsUser(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CifsUser DeserializeCifsUser(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string username = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("username"u8)) + if (prop.NameEquals("username"u8)) { - username = property.Value.GetString(); + username = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new CifsUser(username, serializedAdditionalRawData); + return new CifsUser(username, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -108,15 +114,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - CifsUser IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + CifsUser IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CifsUser PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeCifsUser(document.RootElement, options); } default: @@ -124,6 +135,7 @@ CifsUser IPersistableModel.Create(BinaryData data, ModelReaderWriterOp } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsUser.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsUser.cs index 7f4917acbbe3..1aad94c2d27f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsUser.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CifsUser.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.NetApp.Models /// The effective CIFS username when accessing the volume data. internal partial class CifsUser { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public CifsUser() @@ -52,11 +23,11 @@ public CifsUser() /// Initializes a new instance of . /// The CIFS user's username. - /// Keeps track of any properties unknown to the library. - internal CifsUser(string username, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal CifsUser(string username, IDictionary additionalBinaryDataProperties) { Username = username; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The CIFS user's username. diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResponse.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResponse.Serialization.cs new file mode 100644 index 000000000000..23abca6ee892 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResponse.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Information about cluster peering process. + public partial class ClusterPeerCommandResponse : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClusterPeerCommandResponse)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(PeerAcceptCommand)) + { + writer.WritePropertyName("peerAcceptCommand"u8); + writer.WriteStringValue(PeerAcceptCommand); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ClusterPeerCommandResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ClusterPeerCommandResponse JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClusterPeerCommandResponse)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeClusterPeerCommandResponse(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ClusterPeerCommandResponse DeserializeClusterPeerCommandResponse(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string peerAcceptCommand = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("peerAcceptCommand"u8)) + { + peerAcceptCommand = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ClusterPeerCommandResponse(peerAcceptCommand, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ClusterPeerCommandResponse)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ClusterPeerCommandResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ClusterPeerCommandResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeClusterPeerCommandResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ClusterPeerCommandResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ClusterPeerCommandResponse FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeClusterPeerCommandResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResponse.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResponse.cs new file mode 100644 index 000000000000..ddb4967e5e35 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResponse.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Information about cluster peering process. + public partial class ClusterPeerCommandResponse + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ClusterPeerCommandResponse() + { + } + + /// Initializes a new instance of . + /// A command that needs to be run on the external ONTAP to accept cluster peering. Will only be present if <code>clusterPeeringStatus</code> is <code>pending</code>. + /// Keeps track of any properties unknown to the library. + internal ClusterPeerCommandResponse(string peerAcceptCommand, IDictionary additionalBinaryDataProperties) + { + PeerAcceptCommand = peerAcceptCommand; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// A command that needs to be run on the external ONTAP to accept cluster peering. Will only be present if <code>clusterPeeringStatus</code> is <code>pending</code>. + public string PeerAcceptCommand { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResult.Serialization.cs deleted file mode 100644 index 9a21e7fa43c8..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResult.Serialization.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class ClusterPeerCommandResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ClusterPeerCommandResult)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(PeerAcceptCommand)) - { - writer.WritePropertyName("peerAcceptCommand"u8); - writer.WriteStringValue(PeerAcceptCommand); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ClusterPeerCommandResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ClusterPeerCommandResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeClusterPeerCommandResult(document.RootElement, options); - } - - internal static ClusterPeerCommandResult DeserializeClusterPeerCommandResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string peerAcceptCommand = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("peerAcceptCommand"u8)) - { - peerAcceptCommand = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ClusterPeerCommandResult(peerAcceptCommand, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(ClusterPeerCommandResult)} does not support writing '{options.Format}' format."); - } - } - - ClusterPeerCommandResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeClusterPeerCommandResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ClusterPeerCommandResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResult.cs deleted file mode 100644 index 776a58ab2e77..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ClusterPeerCommandResult.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Information about cluster peering process. - public partial class ClusterPeerCommandResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal ClusterPeerCommandResult() - { - } - - /// Initializes a new instance of . - /// A command that needs to be run on the external ONTAP to accept cluster peering. Will only be present if <code>clusterPeeringStatus</code> is <code>pending</code>. - /// Keeps track of any properties unknown to the library. - internal ClusterPeerCommandResult(string peerAcceptCommand, IDictionary serializedAdditionalRawData) - { - PeerAcceptCommand = peerAcceptCommand; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A command that needs to be run on the external ONTAP to accept cluster peering. Will only be present if <code>clusterPeeringStatus</code> is <code>pending</code>. - public string PeerAcceptCommand { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CoolAccessRetrievalPolicy.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CoolAccessRetrievalPolicy.cs index e4036665a502..7088832f3821 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CoolAccessRetrievalPolicy.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CoolAccessRetrievalPolicy.cs @@ -7,53 +7,72 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. /// public readonly partial struct CoolAccessRetrievalPolicy : IEquatable { private readonly string _value; + private const string DefaultValue = "Default"; + private const string OnReadValue = "OnRead"; + private const string NeverValue = "Never"; /// Initializes a new instance of . + /// The value. /// is null. public CoolAccessRetrievalPolicy(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string DefaultValue = "Default"; - private const string OnReadValue = "OnRead"; - private const string NeverValue = "Never"; + _value = value; + } - /// Default. + /// Gets the Default. public static CoolAccessRetrievalPolicy Default { get; } = new CoolAccessRetrievalPolicy(DefaultValue); - /// OnRead. + + /// Gets the OnRead. public static CoolAccessRetrievalPolicy OnRead { get; } = new CoolAccessRetrievalPolicy(OnReadValue); - /// Never. + + /// Gets the Never. public static CoolAccessRetrievalPolicy Never { get; } = new CoolAccessRetrievalPolicy(NeverValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(CoolAccessRetrievalPolicy left, CoolAccessRetrievalPolicy right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(CoolAccessRetrievalPolicy left, CoolAccessRetrievalPolicy right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator CoolAccessRetrievalPolicy(string value) => new CoolAccessRetrievalPolicy(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator CoolAccessRetrievalPolicy?(string value) => value == null ? null : new CoolAccessRetrievalPolicy(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is CoolAccessRetrievalPolicy other && Equals(other); - /// + + /// public bool Equals(CoolAccessRetrievalPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CoolAccessTieringPolicy.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CoolAccessTieringPolicy.cs index c170727383c5..c04daad49506 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CoolAccessTieringPolicy.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CoolAccessTieringPolicy.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct CoolAccessTieringPolicy : IEquatable { private readonly string _value; + private const string AutoValue = "Auto"; + private const string SnapshotOnlyValue = "SnapshotOnly"; /// Initializes a new instance of . + /// The value. /// is null. public CoolAccessTieringPolicy(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AutoValue = "Auto"; - private const string SnapshotOnlyValue = "SnapshotOnly"; + _value = value; + } - /// Auto. + /// Gets the Auto. public static CoolAccessTieringPolicy Auto { get; } = new CoolAccessTieringPolicy(AutoValue); - /// SnapshotOnly. + + /// Gets the SnapshotOnly. public static CoolAccessTieringPolicy SnapshotOnly { get; } = new CoolAccessTieringPolicy(SnapshotOnlyValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(CoolAccessTieringPolicy left, CoolAccessTieringPolicy right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(CoolAccessTieringPolicy left, CoolAccessTieringPolicy right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator CoolAccessTieringPolicy(string value) => new CoolAccessTieringPolicy(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator CoolAccessTieringPolicy?(string value) => value == null ? null : new CoolAccessTieringPolicy(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is CoolAccessTieringPolicy other && Equals(other); - /// + + /// public bool Equals(CoolAccessTieringPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CredentialsStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CredentialsStatus.cs new file mode 100644 index 000000000000..c59bd6041d6d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/CredentialsStatus.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// + /// The bucket credentials status. There states: + /// + /// "NoCredentialsSet": Access and Secret key pair have not been generated. + /// "CredentialsExpired": Access and Secret key pair have expired. + /// "Active": The certificate has been installed and credentials are unexpired. + /// + public readonly partial struct CredentialsStatus : IEquatable + { + private readonly string _value; + /// Access and Secret key pair have not been generated. + private const string NoCredentialsSetValue = "NoCredentialsSet"; + /// Access and Secret key pair have expired. + private const string CredentialsExpiredValue = "CredentialsExpired"; + /// The certificate has been installed on the bucket server and the bucket credentials are unexpired. + private const string ActiveValue = "Active"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public CredentialsStatus(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Access and Secret key pair have not been generated. + public static CredentialsStatus NoCredentialsSet { get; } = new CredentialsStatus(NoCredentialsSetValue); + + /// Access and Secret key pair have expired. + public static CredentialsStatus CredentialsExpired { get; } = new CredentialsStatus(CredentialsExpiredValue); + + /// The certificate has been installed on the bucket server and the bucket credentials are unexpired. + public static CredentialsStatus Active { get; } = new CredentialsStatus(ActiveValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(CredentialsStatus left, CredentialsStatus right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(CredentialsStatus left, CredentialsStatus right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator CredentialsStatus(string value) => new CredentialsStatus(value); + + /// Converts a string to a . + /// The value. + public static implicit operator CredentialsStatus?(string value) => value == null ? null : new CredentialsStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CredentialsStatus other && Equals(other); + + /// + public bool Equals(CredentialsStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DailySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DailySchedule.Serialization.cs new file mode 100644 index 000000000000..d6aeebf98185 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DailySchedule.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Daily Schedule properties. + public partial class DailySchedule : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DailySchedule)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotsToKeep)) + { + writer.WritePropertyName("snapshotsToKeep"u8); + writer.WriteNumberValue(SnapshotsToKeep.Value); + } + if (Optional.IsDefined(Hour)) + { + writer.WritePropertyName("hour"u8); + writer.WriteNumberValue(Hour.Value); + } + if (Optional.IsDefined(Minute)) + { + writer.WritePropertyName("minute"u8); + writer.WriteNumberValue(Minute.Value); + } + if (Optional.IsDefined(UsedBytes)) + { + writer.WritePropertyName("usedBytes"u8); + writer.WriteNumberValue(UsedBytes.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + DailySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DailySchedule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DailySchedule)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDailySchedule(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DailySchedule DeserializeDailySchedule(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? snapshotsToKeep = default; + int? hour = default; + int? minute = default; + long? usedBytes = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("hour"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hour = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("minute"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minute = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("usedBytes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usedBytes = prop.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new DailySchedule(snapshotsToKeep, hour, minute, usedBytes, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(DailySchedule)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + DailySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DailySchedule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeDailySchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DailySchedule)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DailySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DailySchedule.cs new file mode 100644 index 000000000000..a8d42630dca8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DailySchedule.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Daily Schedule properties. + public partial class DailySchedule + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public DailySchedule() + { + } + + /// Initializes a new instance of . + /// Daily snapshot count to keep. + /// Indicates which hour in UTC timezone a snapshot should be taken. + /// Indicates which minute snapshot should be taken. + /// Resource size in bytes, current storage usage for the volume in bytes. + /// Keeps track of any properties unknown to the library. + internal DailySchedule(int? snapshotsToKeep, int? hour, int? minute, long? usedBytes, IDictionary additionalBinaryDataProperties) + { + SnapshotsToKeep = snapshotsToKeep; + Hour = hour; + Minute = minute; + UsedBytes = usedBytes; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Daily snapshot count to keep. + public int? SnapshotsToKeep { get; set; } + + /// Indicates which hour in UTC timezone a snapshot should be taken. + public int? Hour { get; set; } + + /// Indicates which minute snapshot should be taken. + public int? Minute { get; set; } + + /// Resource size in bytes, current storage usage for the volume in bytes. + public long? UsedBytes { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DayOfWeek.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DayOfWeek.cs new file mode 100644 index 000000000000..2ec840b19ca0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DayOfWeek.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Day of the week. + public readonly partial struct DayOfWeek : IEquatable + { + private readonly string _value; + /// Take a snapshot each Sunday. + private const string SundayValue = "Sunday"; + /// Take a snapshot each Monday. + private const string MondayValue = "Monday"; + /// Take a snapshot each Tuesday. + private const string TuesdayValue = "Tuesday"; + /// Take a snapshot each Wednesday. + private const string WednesdayValue = "Wednesday "; + /// Take a snapshot each Thursday. + private const string ThursdayValue = "Thursday"; + /// Take a snapshot each Friday. + private const string FridayValue = "Friday"; + /// Take a snapshot each Saturday. + private const string SaturdayValue = "Saturday"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public DayOfWeek(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Take a snapshot each Sunday. + public static DayOfWeek Sunday { get; } = new DayOfWeek(SundayValue); + + /// Take a snapshot each Monday. + public static DayOfWeek Monday { get; } = new DayOfWeek(MondayValue); + + /// Take a snapshot each Tuesday. + public static DayOfWeek Tuesday { get; } = new DayOfWeek(TuesdayValue); + + /// Take a snapshot each Wednesday. + public static DayOfWeek Wednesday { get; } = new DayOfWeek(WednesdayValue); + + /// Take a snapshot each Thursday. + public static DayOfWeek Thursday { get; } = new DayOfWeek(ThursdayValue); + + /// Take a snapshot each Friday. + public static DayOfWeek Friday { get; } = new DayOfWeek(FridayValue); + + /// Take a snapshot each Saturday. + public static DayOfWeek Saturday { get; } = new DayOfWeek(SaturdayValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(DayOfWeek left, DayOfWeek right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(DayOfWeek left, DayOfWeek right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator DayOfWeek(string value) => new DayOfWeek(value); + + /// Converts a string to a . + /// The value. + public static implicit operator DayOfWeek?(string value) => value == null ? null : new DayOfWeek(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DayOfWeek other && Equals(other); + + /// + public bool Equals(DayOfWeek other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DesiredRansomwareProtectionState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DesiredRansomwareProtectionState.cs new file mode 100644 index 000000000000..23878ddde317 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DesiredRansomwareProtectionState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The desired state of the Advanced Ransomware Protection feature. + public readonly partial struct DesiredRansomwareProtectionState : IEquatable + { + private readonly string _value; + /// Advanced Ransomware Protection is disabled. + private const string DisabledValue = "Disabled"; + /// Advanced Ransomware Protection is enabled. + private const string EnabledValue = "Enabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public DesiredRansomwareProtectionState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Advanced Ransomware Protection is disabled. + public static DesiredRansomwareProtectionState Disabled { get; } = new DesiredRansomwareProtectionState(DisabledValue); + + /// Advanced Ransomware Protection is enabled. + public static DesiredRansomwareProtectionState Enabled { get; } = new DesiredRansomwareProtectionState(EnabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(DesiredRansomwareProtectionState left, DesiredRansomwareProtectionState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(DesiredRansomwareProtectionState left, DesiredRansomwareProtectionState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator DesiredRansomwareProtectionState(string value) => new DesiredRansomwareProtectionState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator DesiredRansomwareProtectionState?(string value) => value == null ? null : new DesiredRansomwareProtectionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DesiredRansomwareProtectionState other && Equals(other); + + /// + public bool Equals(DesiredRansomwareProtectionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DestinationReplication.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DestinationReplication.Serialization.cs new file mode 100644 index 000000000000..93f7e03d9a49 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DestinationReplication.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Destination replication properties. + public partial class DestinationReplication : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DestinationReplication)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(ReplicationType)) + { + writer.WritePropertyName("replicationType"u8); + writer.WriteStringValue(ReplicationType.Value.ToString()); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (Optional.IsDefined(Zone)) + { + writer.WritePropertyName("zone"u8); + writer.WriteStringValue(Zone); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + DestinationReplication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DestinationReplication JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DestinationReplication)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDestinationReplication(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DestinationReplication DeserializeDestinationReplication(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier resourceId = default; + ReplicationType? replicationType = default; + string region = default; + string zone = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("resourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("replicationType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replicationType = new ReplicationType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("region"u8)) + { + region = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("zone"u8)) + { + zone = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new DestinationReplication(resourceId, replicationType, region, zone, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(DestinationReplication)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + DestinationReplication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DestinationReplication PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeDestinationReplication(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DestinationReplication)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DestinationReplication.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DestinationReplication.cs new file mode 100644 index 000000000000..7458e365db67 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/DestinationReplication.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Destination replication properties. + public partial class DestinationReplication + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal DestinationReplication() + { + } + + /// Initializes a new instance of . + /// The resource ID of the remote volume. + /// Indicates whether the replication is cross zone or cross region. + /// The remote region for the destination volume. + /// The remote zone for the destination volume. + /// Keeps track of any properties unknown to the library. + internal DestinationReplication(ResourceIdentifier resourceId, ReplicationType? replicationType, string region, string zone, IDictionary additionalBinaryDataProperties) + { + ResourceId = resourceId; + ReplicationType = replicationType; + Region = region; + Zone = zone; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The resource ID of the remote volume. + public ResourceIdentifier ResourceId { get; } + + /// Indicates whether the replication is cross zone or cross region. + public ReplicationType? ReplicationType { get; } + + /// The remote region for the destination volume. + public string Region { get; } + + /// The remote zone for the destination volume. + public string Zone { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Dimension.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Dimension.Serialization.cs new file mode 100644 index 000000000000..c9d5ba783921 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Dimension.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Dimension of blobs, possibly be blob type or access tier. + public partial class Dimension : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Dimension)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + Dimension IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual Dimension JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Dimension)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDimension(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static Dimension DeserializeDimension(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string displayName = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("displayName"u8)) + { + displayName = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new Dimension(name, displayName, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(Dimension)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + Dimension IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual Dimension PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeDimension(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Dimension)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Dimension.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Dimension.cs new file mode 100644 index 000000000000..7764d7cf5af0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Dimension.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Dimension of blobs, possibly be blob type or access tier. + public partial class Dimension + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal Dimension() + { + } + + /// Initializes a new instance of . + /// Display name of dimension. + /// Display name of dimension. + /// Keeps track of any properties unknown to the library. + internal Dimension(string name, string displayName, IDictionary additionalBinaryDataProperties) + { + Name = name; + DisplayName = displayName; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Display name of dimension. + public string Name { get; } + + /// Display name of dimension. + public string DisplayName { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountListResult.Serialization.cs new file mode 100644 index 000000000000..c872b71488f6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticAccount list operation. + internal partial class ElasticAccountListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticAccountListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticAccountListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ElasticAccountData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticAccountListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticAccountListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticAccountListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticAccountListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticAccountListResult DeserializeElasticAccountListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticAccountData.DeserializeElasticAccountData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticAccountListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticAccountListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticAccountListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticAccountListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticAccountListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticAccountListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ElasticAccountListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticAccountListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountListResult.cs new file mode 100644 index 000000000000..be556ce683a8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticAccount list operation. + internal partial class ElasticAccountListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ElasticAccount items on this page. + internal ElasticAccountListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ElasticAccount items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ElasticAccountListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ElasticAccount items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountPatch.Serialization.cs new file mode 100644 index 000000000000..01bfc0e32f9a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountPatch.Serialization.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The type used for update operations of the ElasticAccount. + public partial class ElasticAccountPatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticAccountPatch)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + ((IJsonModel)Identity).Write(writer, options); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticAccountPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticAccountPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticAccountPatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticAccountPatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticAccountPatch DeserializeElasticAccountPatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedServiceIdentity identity = default; + IDictionary tags = default; + ElasticAccountUpdateProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("identity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticAccountUpdateProperties.DeserializeElasticAccountUpdateProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticAccountPatch(identity, tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticAccountPatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticAccountPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticAccountPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticAccountPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticAccountPatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticAccountPatch elasticAccountPatch) + { + if (elasticAccountPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticAccountPatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountPatch.cs new file mode 100644 index 000000000000..3df3b3c57551 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountPatch.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The type used for update operations of the ElasticAccount. + public partial class ElasticAccountPatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticAccountPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The managed service identities assigned to this resource. + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal ElasticAccountPatch(ManagedServiceIdentity identity, IDictionary tags, ElasticAccountUpdateProperties properties, IDictionary additionalBinaryDataProperties) + { + Identity = identity; + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + + /// Resource tags. + public IDictionary Tags { get; } + + /// The resource-specific properties for this resource. + internal ElasticAccountUpdateProperties Properties { get; set; } + + /// Encryption settings. + public ElasticEncryption ElasticAccountUpdateEncryption + { + get + { + return Properties is null ? default : Properties.Encryption; + } + set + { + if (Properties is null) + { + Properties = new ElasticAccountUpdateProperties(); + } + Properties.Encryption = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountProperties.Serialization.cs new file mode 100644 index 000000000000..11736f4b17cc --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountProperties.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// NetApp elastic account properties. + public partial class ElasticAccountProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticAccountProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"u8); + writer.WriteObjectValue(Encryption, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticAccountProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticAccountProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticAccountProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticAccountProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticAccountProperties DeserializeElasticAccountProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Models.NetAppProvisioningState? provisioningState = default; + ElasticEncryption encryption = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("encryption"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = ElasticEncryption.DeserializeElasticEncryption(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticAccountProperties(provisioningState, encryption, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticAccountProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticAccountProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticAccountProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticAccountProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticAccountProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountProperties.cs new file mode 100644 index 000000000000..e9da4b42930d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountProperties.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// NetApp elastic account properties. + public partial class ElasticAccountProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticAccountProperties() + { + } + + /// Initializes a new instance of . + /// Azure lifecycle management. + /// Encryption settings. + /// Keeps track of any properties unknown to the library. + internal ElasticAccountProperties(Models.NetAppProvisioningState? provisioningState, ElasticEncryption encryption, IDictionary additionalBinaryDataProperties) + { + ProvisioningState = provisioningState; + Encryption = encryption; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ProvisioningState { get; } + + /// Encryption settings. + public ElasticEncryption Encryption { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountUpdateProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..21299df595eb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountUpdateProperties.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The updatable properties of the ElasticAccount. + internal partial class ElasticAccountUpdateProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticAccountUpdateProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"u8); + writer.WriteObjectValue(Encryption, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticAccountUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticAccountUpdateProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticAccountUpdateProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticAccountUpdateProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticAccountUpdateProperties DeserializeElasticAccountUpdateProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ElasticEncryption encryption = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("encryption"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = ElasticEncryption.DeserializeElasticEncryption(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticAccountUpdateProperties(encryption, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticAccountUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticAccountUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticAccountUpdateProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticAccountUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticAccountUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountUpdateProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountUpdateProperties.cs new file mode 100644 index 000000000000..8a3de2ab99f6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticAccountUpdateProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The updatable properties of the ElasticAccount. + internal partial class ElasticAccountUpdateProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticAccountUpdateProperties() + { + } + + /// Initializes a new instance of . + /// Encryption settings. + /// Keeps track of any properties unknown to the library. + internal ElasticAccountUpdateProperties(ElasticEncryption encryption, IDictionary additionalBinaryDataProperties) + { + Encryption = encryption; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Encryption settings. + public ElasticEncryption Encryption { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupListResult.Serialization.cs new file mode 100644 index 000000000000..8be91897ea81 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticBackup list operation. + internal partial class ElasticBackupListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticBackupListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ElasticBackupData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticBackupListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticBackupListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticBackupListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticBackupListResult DeserializeElasticBackupListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticBackupData.DeserializeElasticBackupData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticBackupListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticBackupListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticBackupListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticBackupListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticBackupListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticBackupListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ElasticBackupListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticBackupListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupListResult.cs new file mode 100644 index 000000000000..7ad0671e590c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticBackup list operation. + internal partial class ElasticBackupListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ElasticBackup items on this page. + internal ElasticBackupListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ElasticBackup items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ElasticBackupListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ElasticBackup items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyListResult.Serialization.cs new file mode 100644 index 000000000000..60dd69de353c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticBackupPolicy list operation. + internal partial class ElasticBackupPolicyListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticBackupPolicyListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupPolicyListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ElasticBackupPolicyData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticBackupPolicyListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticBackupPolicyListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupPolicyListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticBackupPolicyListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticBackupPolicyListResult DeserializeElasticBackupPolicyListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticBackupPolicyData.DeserializeElasticBackupPolicyData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticBackupPolicyListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticBackupPolicyListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticBackupPolicyListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticBackupPolicyListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticBackupPolicyListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticBackupPolicyListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ElasticBackupPolicyListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticBackupPolicyListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyListResult.cs new file mode 100644 index 000000000000..bd09744c5fbc --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticBackupPolicy list operation. + internal partial class ElasticBackupPolicyListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ElasticBackupPolicy items on this page. + internal ElasticBackupPolicyListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ElasticBackupPolicy items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ElasticBackupPolicyListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ElasticBackupPolicy items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyProperties.Serialization.cs new file mode 100644 index 000000000000..031200d4d7ca --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyProperties.Serialization.cs @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Backup Policy properties. + public partial class ElasticBackupPolicyProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupPolicyProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(DailyBackupsToKeep)) + { + writer.WritePropertyName("dailyBackupsToKeep"u8); + writer.WriteNumberValue(DailyBackupsToKeep.Value); + } + if (Optional.IsDefined(WeeklyBackupsToKeep)) + { + writer.WritePropertyName("weeklyBackupsToKeep"u8); + writer.WriteNumberValue(WeeklyBackupsToKeep.Value); + } + if (Optional.IsDefined(MonthlyBackupsToKeep)) + { + writer.WritePropertyName("monthlyBackupsToKeep"u8); + writer.WriteNumberValue(MonthlyBackupsToKeep.Value); + } + if (options.Format != "W" && Optional.IsDefined(AssignedVolumesCount)) + { + writer.WritePropertyName("assignedVolumesCount"u8); + writer.WriteNumberValue(AssignedVolumesCount.Value); + } + if (Optional.IsDefined(PolicyState)) + { + writer.WritePropertyName("policyState"u8); + writer.WriteStringValue(PolicyState.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticBackupPolicyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticBackupPolicyProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupPolicyProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticBackupPolicyProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticBackupPolicyProperties DeserializeElasticBackupPolicyProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Models.NetAppProvisioningState? provisioningState = default; + int? dailyBackupsToKeep = default; + int? weeklyBackupsToKeep = default; + int? monthlyBackupsToKeep = default; + int? assignedVolumesCount = default; + PolicyState? policyState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("dailyBackupsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dailyBackupsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("weeklyBackupsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + weeklyBackupsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("monthlyBackupsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlyBackupsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("assignedVolumesCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + assignedVolumesCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("policyState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyState = new PolicyState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticBackupPolicyProperties( + provisioningState, + dailyBackupsToKeep, + weeklyBackupsToKeep, + monthlyBackupsToKeep, + assignedVolumesCount, + policyState, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticBackupPolicyProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticBackupPolicyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticBackupPolicyProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticBackupPolicyProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticBackupPolicyProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyProperties.cs new file mode 100644 index 000000000000..cd8402060e6d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupPolicyProperties.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Backup Policy properties. + public partial class ElasticBackupPolicyProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticBackupPolicyProperties() + { + } + + /// Initializes a new instance of . + /// Azure lifecycle management. + /// Daily backups count to keep. + /// Weekly backups count to keep. + /// Monthly backups count to keep. + /// The number of volumes currently using this backup policy. + /// The property to identify whether backup policy is enabled or not. + /// Keeps track of any properties unknown to the library. + internal ElasticBackupPolicyProperties(Models.NetAppProvisioningState? provisioningState, int? dailyBackupsToKeep, int? weeklyBackupsToKeep, int? monthlyBackupsToKeep, int? assignedVolumesCount, PolicyState? policyState, IDictionary additionalBinaryDataProperties) + { + ProvisioningState = provisioningState; + DailyBackupsToKeep = dailyBackupsToKeep; + WeeklyBackupsToKeep = weeklyBackupsToKeep; + MonthlyBackupsToKeep = monthlyBackupsToKeep; + AssignedVolumesCount = assignedVolumesCount; + PolicyState = policyState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ProvisioningState { get; } + + /// Daily backups count to keep. + public int? DailyBackupsToKeep { get; set; } + + /// Weekly backups count to keep. + public int? WeeklyBackupsToKeep { get; set; } + + /// Monthly backups count to keep. + public int? MonthlyBackupsToKeep { get; set; } + + /// The number of volumes currently using this backup policy. + public int? AssignedVolumesCount { get; } + + /// The property to identify whether backup policy is enabled or not. + public PolicyState? PolicyState { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupProperties.Serialization.cs new file mode 100644 index 000000000000..9157b18aef6d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupProperties.Serialization.cs @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Backup properties. + public partial class ElasticBackupProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticBackupProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("creationDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(SnapshotCreationOn)) + { + writer.WritePropertyName("snapshotCreationDate"u8); + writer.WriteStringValue(SnapshotCreationOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(CompletionOn)) + { + writer.WritePropertyName("completionDate"u8); + writer.WriteStringValue(CompletionOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(Label)) + { + writer.WritePropertyName("label"u8); + writer.WriteStringValue(Label); + } + if (options.Format != "W" && Optional.IsDefined(BackupType)) + { + writer.WritePropertyName("backupType"u8); + writer.WriteStringValue(BackupType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(FailureReason)) + { + writer.WritePropertyName("failureReason"u8); + writer.WriteStringValue(FailureReason); + } + writer.WritePropertyName("elasticVolumeResourceId"u8); + writer.WriteStringValue(ElasticVolumeResourceId); + if (Optional.IsDefined(SnapshotUsage)) + { + writer.WritePropertyName("snapshotUsage"u8); + writer.WriteStringValue(SnapshotUsage.Value.ToString()); + } + if (Optional.IsDefined(ElasticSnapshotResourceId)) + { + writer.WritePropertyName("elasticSnapshotResourceId"u8); + writer.WriteStringValue(ElasticSnapshotResourceId); + } + if (options.Format != "W" && Optional.IsDefined(ElasticBackupPolicyResourceId)) + { + writer.WritePropertyName("elasticBackupPolicyResourceId"u8); + writer.WriteStringValue(ElasticBackupPolicyResourceId); + } + if (options.Format != "W" && Optional.IsDefined(VolumeSize)) + { + writer.WritePropertyName("volumeSize"u8); + writer.WriteStringValue(VolumeSize.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticBackupProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticBackupProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticBackupProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticBackupProperties DeserializeElasticBackupProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? createdOn = default; + DateTimeOffset? snapshotCreationOn = default; + DateTimeOffset? completionOn = default; + Models.NetAppProvisioningState? provisioningState = default; + long? size = default; + string label = default; + ElasticBackupType? backupType = default; + string failureReason = default; + ResourceIdentifier elasticVolumeResourceId = default; + SnapshotUsage? snapshotUsage = default; + ResourceIdentifier elasticSnapshotResourceId = default; + ResourceIdentifier elasticBackupPolicyResourceId = default; + VolumeSize? volumeSize = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("creationDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("snapshotCreationDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotCreationOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("completionDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + completionOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("size"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("label"u8)) + { + label = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("backupType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupType = new ElasticBackupType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("failureReason"u8)) + { + failureReason = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("elasticVolumeResourceId"u8)) + { + elasticVolumeResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("snapshotUsage"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotUsage = new SnapshotUsage(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("elasticSnapshotResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + elasticSnapshotResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("elasticBackupPolicyResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + elasticBackupPolicyResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("volumeSize"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + volumeSize = new VolumeSize(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticBackupProperties( + createdOn, + snapshotCreationOn, + completionOn, + provisioningState, + size, + label, + backupType, + failureReason, + elasticVolumeResourceId, + snapshotUsage, + elasticSnapshotResourceId, + elasticBackupPolicyResourceId, + volumeSize, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticBackupProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticBackupProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticBackupProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticBackupProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticBackupProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupProperties.cs new file mode 100644 index 000000000000..fdd72ba5c80d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupProperties.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Backup properties. + public partial class ElasticBackupProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// ResourceId used to identify the Elastic Volume. + /// is null. + public ElasticBackupProperties(ResourceIdentifier elasticVolumeResourceId) + { + Argument.AssertNotNull(elasticVolumeResourceId, nameof(elasticVolumeResourceId)); + + ElasticVolumeResourceId = elasticVolumeResourceId; + } + + /// Initializes a new instance of . + /// The creation date of the backup. + /// The snapshot creation date of the backup. + /// The completion date of the backup. + /// Azure lifecycle management. + /// Size of backup in bytes. + /// Label for backup. + /// Type of backup Manual or Scheduled. + /// Failure reason. + /// ResourceId used to identify the Elastic Volume. + /// Manual backup using an already existing snapshot. This will always be CreateNewSnapshot for scheduled backups and UseExistingSnapshot/CreateNewSnapshot for manual backups. + /// ResourceId used to identify the elastic snapshot resource. This is required when an existing snapshot needs to be used for creating a manual backup. + /// ResourceId used to identify the elastic backup policy. + /// Specifies if the backup is for a large volume. + /// Keeps track of any properties unknown to the library. + internal ElasticBackupProperties(DateTimeOffset? createdOn, DateTimeOffset? snapshotCreationOn, DateTimeOffset? completionOn, Models.NetAppProvisioningState? provisioningState, long? size, string label, ElasticBackupType? backupType, string failureReason, ResourceIdentifier elasticVolumeResourceId, SnapshotUsage? snapshotUsage, ResourceIdentifier elasticSnapshotResourceId, ResourceIdentifier elasticBackupPolicyResourceId, VolumeSize? volumeSize, IDictionary additionalBinaryDataProperties) + { + CreatedOn = createdOn; + SnapshotCreationOn = snapshotCreationOn; + CompletionOn = completionOn; + ProvisioningState = provisioningState; + Size = size; + Label = label; + BackupType = backupType; + FailureReason = failureReason; + ElasticVolumeResourceId = elasticVolumeResourceId; + SnapshotUsage = snapshotUsage; + ElasticSnapshotResourceId = elasticSnapshotResourceId; + ElasticBackupPolicyResourceId = elasticBackupPolicyResourceId; + VolumeSize = volumeSize; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The creation date of the backup. + public DateTimeOffset? CreatedOn { get; } + + /// The snapshot creation date of the backup. + public DateTimeOffset? SnapshotCreationOn { get; } + + /// The completion date of the backup. + public DateTimeOffset? CompletionOn { get; } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ProvisioningState { get; } + + /// Size of backup in bytes. + public long? Size { get; } + + /// Label for backup. + public string Label { get; set; } + + /// Type of backup Manual or Scheduled. + public ElasticBackupType? BackupType { get; } + + /// Failure reason. + public string FailureReason { get; } + + /// ResourceId used to identify the Elastic Volume. + public ResourceIdentifier ElasticVolumeResourceId { get; set; } + + /// Manual backup using an already existing snapshot. This will always be CreateNewSnapshot for scheduled backups and UseExistingSnapshot/CreateNewSnapshot for manual backups. + public SnapshotUsage? SnapshotUsage { get; set; } + + /// ResourceId used to identify the elastic snapshot resource. This is required when an existing snapshot needs to be used for creating a manual backup. + public ResourceIdentifier ElasticSnapshotResourceId { get; set; } + + /// ResourceId used to identify the elastic backup policy. + public ResourceIdentifier ElasticBackupPolicyResourceId { get; } + + /// Specifies if the backup is for a large volume. + public VolumeSize? VolumeSize { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupType.cs new file mode 100644 index 000000000000..4b6deaa05d34 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupType.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Type of backup. + public readonly partial struct ElasticBackupType : IEquatable + { + private readonly string _value; + /// Manual backup type. + private const string ManualValue = "Manual"; + /// Scheduled backup type. + private const string ScheduledValue = "Scheduled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticBackupType(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Manual backup type. + public static ElasticBackupType Manual { get; } = new ElasticBackupType(ManualValue); + + /// Scheduled backup type. + public static ElasticBackupType Scheduled { get; } = new ElasticBackupType(ScheduledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticBackupType left, ElasticBackupType right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticBackupType left, ElasticBackupType right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticBackupType(string value) => new ElasticBackupType(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticBackupType?(string value) => value == null ? null : new ElasticBackupType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticBackupType other && Equals(other); + + /// + public bool Equals(ElasticBackupType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultListResult.Serialization.cs new file mode 100644 index 000000000000..2b935b1f76d8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticBackupVault list operation. + internal partial class ElasticBackupVaultListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticBackupVaultListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupVaultListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ElasticBackupVaultData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticBackupVaultListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticBackupVaultListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupVaultListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticBackupVaultListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticBackupVaultListResult DeserializeElasticBackupVaultListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticBackupVaultData.DeserializeElasticBackupVaultData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticBackupVaultListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticBackupVaultListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticBackupVaultListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticBackupVaultListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticBackupVaultListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticBackupVaultListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ElasticBackupVaultListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticBackupVaultListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultListResult.cs new file mode 100644 index 000000000000..150e350155e5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticBackupVault list operation. + internal partial class ElasticBackupVaultListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ElasticBackupVault items on this page. + internal ElasticBackupVaultListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ElasticBackupVault items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ElasticBackupVaultListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ElasticBackupVault items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultProperties.Serialization.cs new file mode 100644 index 000000000000..81eee0815092 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultProperties.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Backup Vault properties. + internal partial class ElasticBackupVaultProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupVaultProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticBackupVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticBackupVaultProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticBackupVaultProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticBackupVaultProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticBackupVaultProperties DeserializeElasticBackupVaultProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Models.NetAppProvisioningState? provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticBackupVaultProperties(provisioningState, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticBackupVaultProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticBackupVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticBackupVaultProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticBackupVaultProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticBackupVaultProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultProperties.cs new file mode 100644 index 000000000000..f4fd6cb62371 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticBackupVaultProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Backup Vault properties. + internal partial class ElasticBackupVaultProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticBackupVaultProperties() + { + } + + /// Initializes a new instance of . + /// Azure lifecycle management. + /// Keeps track of any properties unknown to the library. + internal ElasticBackupVaultProperties(Models.NetAppProvisioningState? provisioningState, IDictionary additionalBinaryDataProperties) + { + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolListResult.Serialization.cs new file mode 100644 index 000000000000..a39799c12880 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticCapacityPool list operation. + internal partial class ElasticCapacityPoolListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticCapacityPoolListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticCapacityPoolListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ElasticCapacityPoolData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticCapacityPoolListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticCapacityPoolListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticCapacityPoolListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticCapacityPoolListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticCapacityPoolListResult DeserializeElasticCapacityPoolListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticCapacityPoolData.DeserializeElasticCapacityPoolData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticCapacityPoolListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticCapacityPoolListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticCapacityPoolListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticCapacityPoolListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticCapacityPoolListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticCapacityPoolListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ElasticCapacityPoolListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticCapacityPoolListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolListResult.cs new file mode 100644 index 000000000000..c3c6d11cba1f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticCapacityPool list operation. + internal partial class ElasticCapacityPoolListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ElasticCapacityPool items on this page. + internal ElasticCapacityPoolListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ElasticCapacityPool items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ElasticCapacityPoolListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ElasticCapacityPool items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolPatch.Serialization.cs new file mode 100644 index 000000000000..fbaa36cb9b35 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolPatch.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The type used for update operations of the ElasticCapacityPool. + public partial class ElasticCapacityPoolPatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticCapacityPoolPatch)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticCapacityPoolPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticCapacityPoolPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticCapacityPoolPatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticCapacityPoolPatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticCapacityPoolPatch DeserializeElasticCapacityPoolPatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + ElasticCapacityPoolUpdateProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticCapacityPoolUpdateProperties.DeserializeElasticCapacityPoolUpdateProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticCapacityPoolPatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticCapacityPoolPatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticCapacityPoolPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticCapacityPoolPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticCapacityPoolPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticCapacityPoolPatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticCapacityPoolPatch elasticCapacityPoolPatch) + { + if (elasticCapacityPoolPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticCapacityPoolPatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolPatch.cs new file mode 100644 index 000000000000..403c9246026d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolPatch.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The type used for update operations of the ElasticCapacityPool. + public partial class ElasticCapacityPoolPatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticCapacityPoolPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal ElasticCapacityPoolPatch(IDictionary tags, ElasticCapacityPoolUpdateProperties properties, IDictionary additionalBinaryDataProperties) + { + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource tags. + public IDictionary Tags { get; } + + /// The resource-specific properties for this resource. + public ElasticCapacityPoolUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolProperties.Serialization.cs new file mode 100644 index 000000000000..4eec2990638f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolProperties.Serialization.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic capacity pool properties. + public partial class ElasticCapacityPoolProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticCapacityPoolProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticCapacityPoolProperties)} does not support writing '{format}' format."); + } + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size); + writer.WritePropertyName("serviceLevel"u8); + writer.WriteStringValue(ServiceLevel.ToString()); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"u8); + writer.WriteObjectValue(Encryption, options); + } + if (options.Format != "W" && Optional.IsDefined(TotalThroughputMibps)) + { + writer.WritePropertyName("totalThroughputMibps"u8); + writer.WriteNumberValue(TotalThroughputMibps.Value); + } + writer.WritePropertyName("subnetResourceId"u8); + writer.WriteStringValue(SubnetResourceId); + if (options.Format != "W" && Optional.IsDefined(CurrentZone)) + { + writer.WritePropertyName("currentZone"u8); + writer.WriteStringValue(CurrentZone); + } + if (options.Format != "W" && Optional.IsDefined(AvailabilityStatus)) + { + writer.WritePropertyName("availabilityStatus"u8); + writer.WriteStringValue(AvailabilityStatus.Value.ToString()); + } + if (Optional.IsDefined(ActiveDirectoryConfigResourceId)) + { + writer.WritePropertyName("activeDirectoryConfigResourceId"u8); + writer.WriteStringValue(ActiveDirectoryConfigResourceId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticCapacityPoolProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticCapacityPoolProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticCapacityPoolProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticCapacityPoolProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticCapacityPoolProperties DeserializeElasticCapacityPoolProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long size = default; + ElasticServiceLevel serviceLevel = default; + Models.NetAppProvisioningState? provisioningState = default; + ElasticEncryptionConfiguration encryption = default; + double? totalThroughputMibps = default; + ResourceIdentifier subnetResourceId = default; + string currentZone = default; + ElasticResourceAvailabilityStatus? availabilityStatus = default; + ResourceIdentifier activeDirectoryConfigResourceId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("size"u8)) + { + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("serviceLevel"u8)) + { + serviceLevel = new ElasticServiceLevel(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("encryption"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = ElasticEncryptionConfiguration.DeserializeElasticEncryptionConfiguration(prop.Value, options); + continue; + } + if (prop.NameEquals("totalThroughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + totalThroughputMibps = prop.Value.GetDouble(); + continue; + } + if (prop.NameEquals("subnetResourceId"u8)) + { + subnetResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("currentZone"u8)) + { + currentZone = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("availabilityStatus"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availabilityStatus = new ElasticResourceAvailabilityStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("activeDirectoryConfigResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activeDirectoryConfigResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticCapacityPoolProperties( + size, + serviceLevel, + provisioningState, + encryption, + totalThroughputMibps, + subnetResourceId, + currentZone, + availabilityStatus, + activeDirectoryConfigResourceId, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticCapacityPoolProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticCapacityPoolProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticCapacityPoolProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticCapacityPoolProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticCapacityPoolProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolProperties.cs new file mode 100644 index 000000000000..5d211ce7260f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolProperties.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic capacity pool properties. + public partial class ElasticCapacityPoolProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Provisioned size of the pool (in bytes). For zoneRedundant service level pool, value must be in the range 1TiB to 16TiB or 1TiB to 128TiB for supported region. Values expressed in bytes as multiples of 1TiB till 16TiB and in multiples of 8TiB from 24TiB to 128TiB. Pool size can't be shrunk once it is created. + /// The service level of the elastic capacity pool. + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/elasticVolumes, this is used by all the volumes within the pool. + /// is null. + public ElasticCapacityPoolProperties(long size, ElasticServiceLevel serviceLevel, ResourceIdentifier subnetResourceId) + { + Argument.AssertNotNull(subnetResourceId, nameof(subnetResourceId)); + + Size = size; + ServiceLevel = serviceLevel; + SubnetResourceId = subnetResourceId; + } + + /// Initializes a new instance of . + /// Provisioned size of the pool (in bytes). For zoneRedundant service level pool, value must be in the range 1TiB to 16TiB or 1TiB to 128TiB for supported region. Values expressed in bytes as multiples of 1TiB till 16TiB and in multiples of 8TiB from 24TiB to 128TiB. Pool size can't be shrunk once it is created. + /// The service level of the elastic capacity pool. + /// Azure lifecycle management. + /// Encryption settings. + /// Total throughput of the pool in MiB/s. + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/elasticVolumes, this is used by all the volumes within the pool. + /// Indicates the current zone of the pool. This can be changed for zoneRedundant service level pool with the changeZone action. + /// Current availability status of the resource. + /// The Azure Resource URI for an Active Directory configuration. This is used by all the SMB volumes within the pool. + /// Keeps track of any properties unknown to the library. + internal ElasticCapacityPoolProperties(long size, ElasticServiceLevel serviceLevel, Models.NetAppProvisioningState? provisioningState, ElasticEncryptionConfiguration encryption, double? totalThroughputMibps, ResourceIdentifier subnetResourceId, string currentZone, ElasticResourceAvailabilityStatus? availabilityStatus, ResourceIdentifier activeDirectoryConfigResourceId, IDictionary additionalBinaryDataProperties) + { + Size = size; + ServiceLevel = serviceLevel; + ProvisioningState = provisioningState; + Encryption = encryption; + TotalThroughputMibps = totalThroughputMibps; + SubnetResourceId = subnetResourceId; + CurrentZone = currentZone; + AvailabilityStatus = availabilityStatus; + ActiveDirectoryConfigResourceId = activeDirectoryConfigResourceId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Provisioned size of the pool (in bytes). For zoneRedundant service level pool, value must be in the range 1TiB to 16TiB or 1TiB to 128TiB for supported region. Values expressed in bytes as multiples of 1TiB till 16TiB and in multiples of 8TiB from 24TiB to 128TiB. Pool size can't be shrunk once it is created. + public long Size { get; set; } + + /// The service level of the elastic capacity pool. + public ElasticServiceLevel ServiceLevel { get; set; } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ProvisioningState { get; } + + /// Encryption settings. + public ElasticEncryptionConfiguration Encryption { get; set; } + + /// Total throughput of the pool in MiB/s. + public double? TotalThroughputMibps { get; } + + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/elasticVolumes, this is used by all the volumes within the pool. + public ResourceIdentifier SubnetResourceId { get; set; } + + /// Indicates the current zone of the pool. This can be changed for zoneRedundant service level pool with the changeZone action. + public string CurrentZone { get; } + + /// Current availability status of the resource. + public ElasticResourceAvailabilityStatus? AvailabilityStatus { get; } + + /// The Azure Resource URI for an Active Directory configuration. This is used by all the SMB volumes within the pool. + public ResourceIdentifier ActiveDirectoryConfigResourceId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolUpdateProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..f87906bab39d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolUpdateProperties.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The updatable properties of the ElasticCapacityPool. + public partial class ElasticCapacityPoolUpdateProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticCapacityPoolUpdateProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"u8); + writer.WriteObjectValue(Encryption, options); + } + if (Optional.IsDefined(ActiveDirectoryConfigResourceId)) + { + writer.WritePropertyName("activeDirectoryConfigResourceId"u8); + writer.WriteStringValue(ActiveDirectoryConfigResourceId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticCapacityPoolUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticCapacityPoolUpdateProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticCapacityPoolUpdateProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticCapacityPoolUpdateProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticCapacityPoolUpdateProperties DeserializeElasticCapacityPoolUpdateProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? size = default; + ElasticEncryptionConfiguration encryption = default; + ResourceIdentifier activeDirectoryConfigResourceId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("size"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("encryption"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = ElasticEncryptionConfiguration.DeserializeElasticEncryptionConfiguration(prop.Value, options); + continue; + } + if (prop.NameEquals("activeDirectoryConfigResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activeDirectoryConfigResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticCapacityPoolUpdateProperties(size, encryption, activeDirectoryConfigResourceId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticCapacityPoolUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticCapacityPoolUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticCapacityPoolUpdateProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticCapacityPoolUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticCapacityPoolUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolUpdateProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolUpdateProperties.cs new file mode 100644 index 000000000000..c078f4c82ed4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticCapacityPoolUpdateProperties.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The updatable properties of the ElasticCapacityPool. + public partial class ElasticCapacityPoolUpdateProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticCapacityPoolUpdateProperties() + { + } + + /// Initializes a new instance of . + /// Provisioned size of the pool (in bytes). For zoneRedundant service level pool, value must be in the range 1TiB to 16TiB or 1TiB to 128TiB for supported region. Values expressed in bytes as multiples of 1TiB till 16TiB and in multiples of 8TiB from 24TiB to 128TiB. Pool size can't be shrunk once it is created. + /// Encryption settings. + /// The Azure Resource URI for an Active Directory configuration. This is used by all the SMB volumes within the pool. + /// Keeps track of any properties unknown to the library. + internal ElasticCapacityPoolUpdateProperties(long? size, ElasticEncryptionConfiguration encryption, ResourceIdentifier activeDirectoryConfigResourceId, IDictionary additionalBinaryDataProperties) + { + Size = size; + Encryption = encryption; + ActiveDirectoryConfigResourceId = activeDirectoryConfigResourceId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Provisioned size of the pool (in bytes). For zoneRedundant service level pool, value must be in the range 1TiB to 16TiB or 1TiB to 128TiB for supported region. Values expressed in bytes as multiples of 1TiB till 16TiB and in multiples of 8TiB from 24TiB to 128TiB. Pool size can't be shrunk once it is created. + public long? Size { get; set; } + + /// Encryption settings. + public ElasticEncryptionConfiguration Encryption { get; set; } + + /// The Azure Resource URI for an Active Directory configuration. This is used by all the SMB volumes within the pool. + public ResourceIdentifier ActiveDirectoryConfigResourceId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryption.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryption.Serialization.cs new file mode 100644 index 000000000000..1cb859906a58 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryption.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Encryption settings. + public partial class ElasticEncryption : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticEncryption)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(KeySource)) + { + writer.WritePropertyName("keySource"u8); + writer.WriteStringValue(KeySource.Value.ToString()); + } + if (Optional.IsDefined(KeyVaultProperties)) + { + writer.WritePropertyName("keyVaultProperties"u8); + writer.WriteObjectValue(KeyVaultProperties, options); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticEncryption IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticEncryption JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticEncryption)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticEncryption(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticEncryption DeserializeElasticEncryption(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeySource? keySource = default; + ElasticKeyVaultProperties keyVaultProperties = default; + ElasticEncryptionIdentity identity = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("keySource"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keySource = new KeySource(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyVaultProperties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultProperties = ElasticKeyVaultProperties.DeserializeElasticKeyVaultProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("identity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ElasticEncryptionIdentity.DeserializeElasticEncryptionIdentity(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticEncryption(keySource, keyVaultProperties, identity, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticEncryption)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticEncryption IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticEncryption PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticEncryption(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticEncryption)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryption.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryption.cs new file mode 100644 index 000000000000..a943874d593d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryption.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Encryption settings. + public partial class ElasticEncryption + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticEncryption() + { + } + + /// Initializes a new instance of . + /// The encryption keySource (provider). Possible values (case-insensitive): Microsoft.NetApp, Microsoft.KeyVault. + /// Properties provided by KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. + /// Identity used to authenticate to KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. + /// Keeps track of any properties unknown to the library. + internal ElasticEncryption(KeySource? keySource, ElasticKeyVaultProperties keyVaultProperties, ElasticEncryptionIdentity identity, IDictionary additionalBinaryDataProperties) + { + KeySource = keySource; + KeyVaultProperties = keyVaultProperties; + Identity = identity; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The encryption keySource (provider). Possible values (case-insensitive): Microsoft.NetApp, Microsoft.KeyVault. + public KeySource? KeySource { get; set; } + + /// Properties provided by KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. + public ElasticKeyVaultProperties KeyVaultProperties { get; set; } + + /// Identity used to authenticate to KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. + public ElasticEncryptionIdentity Identity { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionConfiguration.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionConfiguration.Serialization.cs new file mode 100644 index 000000000000..227144db671e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionConfiguration.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// CMK Encryption Configuration. + public partial class ElasticEncryptionConfiguration : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticEncryptionConfiguration() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticEncryptionConfiguration)} does not support writing '{format}' format."); + } + writer.WritePropertyName("elasticPoolEncryptionKeySource"u8); + writer.WriteStringValue(ElasticPoolEncryptionKeySource.ToString()); + writer.WritePropertyName("keyVaultPrivateEndpointResourceId"u8); + writer.WriteStringValue(KeyVaultPrivateEndpointResourceId); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticEncryptionConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticEncryptionConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticEncryptionConfiguration)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticEncryptionConfiguration(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticEncryptionConfiguration DeserializeElasticEncryptionConfiguration(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ElasticPoolEncryptionKeySource elasticPoolEncryptionKeySource = default; + ResourceIdentifier keyVaultPrivateEndpointResourceId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("elasticPoolEncryptionKeySource"u8)) + { + elasticPoolEncryptionKeySource = new ElasticPoolEncryptionKeySource(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyVaultPrivateEndpointResourceId"u8)) + { + keyVaultPrivateEndpointResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticEncryptionConfiguration(elasticPoolEncryptionKeySource, keyVaultPrivateEndpointResourceId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticEncryptionConfiguration)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticEncryptionConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticEncryptionConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticEncryptionConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticEncryptionConfiguration)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionConfiguration.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionConfiguration.cs new file mode 100644 index 000000000000..98369ee37240 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionConfiguration.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// CMK Encryption Configuration. + public partial class ElasticEncryptionConfiguration + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Pool Encryption Key Source. + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. + /// is null. + public ElasticEncryptionConfiguration(ElasticPoolEncryptionKeySource elasticPoolEncryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId) + { + Argument.AssertNotNull(keyVaultPrivateEndpointResourceId, nameof(keyVaultPrivateEndpointResourceId)); + + ElasticPoolEncryptionKeySource = elasticPoolEncryptionKeySource; + KeyVaultPrivateEndpointResourceId = keyVaultPrivateEndpointResourceId; + } + + /// Initializes a new instance of . + /// Pool Encryption Key Source. + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. + /// Keeps track of any properties unknown to the library. + internal ElasticEncryptionConfiguration(ElasticPoolEncryptionKeySource elasticPoolEncryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, IDictionary additionalBinaryDataProperties) + { + ElasticPoolEncryptionKeySource = elasticPoolEncryptionKeySource; + KeyVaultPrivateEndpointResourceId = keyVaultPrivateEndpointResourceId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Pool Encryption Key Source. + public ElasticPoolEncryptionKeySource ElasticPoolEncryptionKeySource { get; set; } + + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. + public ResourceIdentifier KeyVaultPrivateEndpointResourceId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionIdentity.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionIdentity.Serialization.cs new file mode 100644 index 000000000000..49f450202178 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionIdentity.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Identity used to authenticate with key vault. + public partial class ElasticEncryptionIdentity : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticEncryptionIdentity)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId); + } + if (Optional.IsDefined(UserAssignedIdentity)) + { + writer.WritePropertyName("userAssignedIdentity"u8); + writer.WriteStringValue(UserAssignedIdentity); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticEncryptionIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticEncryptionIdentity JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticEncryptionIdentity)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticEncryptionIdentity(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticEncryptionIdentity DeserializeElasticEncryptionIdentity(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string principalId = default; + ResourceIdentifier userAssignedIdentity = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("principalId"u8)) + { + principalId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("userAssignedIdentity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userAssignedIdentity = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticEncryptionIdentity(principalId, userAssignedIdentity, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticEncryptionIdentity)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticEncryptionIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticEncryptionIdentity PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticEncryptionIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticEncryptionIdentity)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionIdentity.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionIdentity.cs new file mode 100644 index 000000000000..133b31f7bb7b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticEncryptionIdentity.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Identity used to authenticate with key vault. + public partial class ElasticEncryptionIdentity + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticEncryptionIdentity() + { + } + + /// Initializes a new instance of . + /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. + /// The ARM resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. + /// Keeps track of any properties unknown to the library. + internal ElasticEncryptionIdentity(string principalId, ResourceIdentifier userAssignedIdentity, IDictionary additionalBinaryDataProperties) + { + PrincipalId = principalId; + UserAssignedIdentity = userAssignedIdentity; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. + public string PrincipalId { get; } + + /// The ARM resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. + public ResourceIdentifier UserAssignedIdentity { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicy.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicy.Serialization.cs new file mode 100644 index 000000000000..12ee7bbf1eeb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicy.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Set of export policy rules. + internal partial class ElasticExportPolicy : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticExportPolicy)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(Rules)) + { + writer.WritePropertyName("rules"u8); + writer.WriteStartArray(); + foreach (ElasticExportPolicyRule item in Rules) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticExportPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticExportPolicy JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticExportPolicy)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticExportPolicy(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticExportPolicy DeserializeElasticExportPolicy(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList rules = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("rules"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticExportPolicyRule.DeserializeElasticExportPolicyRule(item, options)); + } + rules = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticExportPolicy(rules ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticExportPolicy)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticExportPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticExportPolicy PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticExportPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticExportPolicy)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicy.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicy.cs new file mode 100644 index 000000000000..aa76e7937b8f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicy.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Set of export policy rules. + internal partial class ElasticExportPolicy + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticExportPolicy() + { + Rules = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Export policy rule. + /// Keeps track of any properties unknown to the library. + internal ElasticExportPolicy(IList rules, IDictionary additionalBinaryDataProperties) + { + Rules = rules; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Export policy rule. + public IList Rules { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicyRule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicyRule.Serialization.cs new file mode 100644 index 000000000000..af7eaa3e3180 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicyRule.Serialization.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Volume Export Policy Rule. + public partial class ElasticExportPolicyRule : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticExportPolicyRule)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(RuleIndex)) + { + writer.WritePropertyName("ruleIndex"u8); + writer.WriteNumberValue(RuleIndex.Value); + } + if (Optional.IsDefined(UnixAccessRule)) + { + writer.WritePropertyName("unixAccessRule"u8); + writer.WriteStringValue(UnixAccessRule.Value.ToString()); + } + if (Optional.IsDefined(Nfsv3)) + { + writer.WritePropertyName("nfsv3"u8); + writer.WriteStringValue(Nfsv3.Value.ToString()); + } + if (Optional.IsDefined(Nfsv4)) + { + writer.WritePropertyName("nfsv4"u8); + writer.WriteStringValue(Nfsv4.Value.ToString()); + } + if (Optional.IsCollectionDefined(AllowedClients)) + { + writer.WritePropertyName("allowedClients"u8); + writer.WriteStartArray(); + foreach (string item in AllowedClients) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(RootAccess)) + { + writer.WritePropertyName("rootAccess"u8); + writer.WriteStringValue(RootAccess.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticExportPolicyRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticExportPolicyRule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticExportPolicyRule)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticExportPolicyRule(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticExportPolicyRule DeserializeElasticExportPolicyRule(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? ruleIndex = default; + ElasticUnixAccessRule? unixAccessRule = default; + ElasticNfsv3Access? nfsv3 = default; + ElasticNfsv4Access? nfsv4 = default; + IList allowedClients = default; + ElasticRootAccess? rootAccess = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("ruleIndex"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ruleIndex = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("unixAccessRule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + unixAccessRule = new ElasticUnixAccessRule(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("nfsv3"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfsv3 = new ElasticNfsv3Access(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("nfsv4"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfsv4 = new ElasticNfsv4Access(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("allowedClients"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + allowedClients = array; + continue; + } + if (prop.NameEquals("rootAccess"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rootAccess = new ElasticRootAccess(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticExportPolicyRule( + ruleIndex, + unixAccessRule, + nfsv3, + nfsv4, + allowedClients ?? new ChangeTrackingList(), + rootAccess, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticExportPolicyRule)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticExportPolicyRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticExportPolicyRule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticExportPolicyRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticExportPolicyRule)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicyRule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicyRule.cs new file mode 100644 index 000000000000..e815aef5c142 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticExportPolicyRule.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Volume Export Policy Rule. + public partial class ElasticExportPolicyRule + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticExportPolicyRule() + { + AllowedClients = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Controls the priority of the export policy rule. When connecting to the volume the rule with the lowest index that applies to the connecting client is used. + /// Specifies the Unix file access level for the volume. It encompasses both read-only and read-write permissions. Additionally, NoAccess can be set to block all access to the volume. + /// Allows clients to access the volume with the NFSv3 protocol. Enable only for NFSv3 type volumes. + /// Allows clients to access the volume with at least NFSv4.1 protocol. + /// Client ingress specification for the export policy as list of IPv4 CIDRs, IPv4 host addresses and host names. + /// Indicates whether root access to the volume is granted to clients affected by this rule. + /// Keeps track of any properties unknown to the library. + internal ElasticExportPolicyRule(int? ruleIndex, ElasticUnixAccessRule? unixAccessRule, ElasticNfsv3Access? nfsv3, ElasticNfsv4Access? nfsv4, IList allowedClients, ElasticRootAccess? rootAccess, IDictionary additionalBinaryDataProperties) + { + RuleIndex = ruleIndex; + UnixAccessRule = unixAccessRule; + Nfsv3 = nfsv3; + Nfsv4 = nfsv4; + AllowedClients = allowedClients; + RootAccess = rootAccess; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Controls the priority of the export policy rule. When connecting to the volume the rule with the lowest index that applies to the connecting client is used. + public int? RuleIndex { get; set; } + + /// Specifies the Unix file access level for the volume. It encompasses both read-only and read-write permissions. Additionally, NoAccess can be set to block all access to the volume. + public ElasticUnixAccessRule? UnixAccessRule { get; set; } + + /// Allows clients to access the volume with the NFSv3 protocol. Enable only for NFSv3 type volumes. + public ElasticNfsv3Access? Nfsv3 { get; set; } + + /// Allows clients to access the volume with at least NFSv4.1 protocol. + public ElasticNfsv4Access? Nfsv4 { get; set; } + + /// Client ingress specification for the export policy as list of IPv4 CIDRs, IPv4 host addresses and host names. + public IList AllowedClients { get; } + + /// Indicates whether root access to the volume is granted to clients affected by this rule. + public ElasticRootAccess? RootAccess { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultProperties.Serialization.cs new file mode 100644 index 000000000000..c31697db89c3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultProperties.Serialization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of key vault. + public partial class ElasticKeyVaultProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticKeyVaultProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(KeyVaultUri)) + { + writer.WritePropertyName("keyVaultUri"u8); + writer.WriteStringValue(KeyVaultUri.AbsoluteUri); + } + if (Optional.IsDefined(KeyName)) + { + writer.WritePropertyName("keyName"u8); + writer.WriteStringValue(KeyName); + } + if (Optional.IsDefined(KeyVaultResourceId)) + { + writer.WritePropertyName("keyVaultResourceId"u8); + writer.WriteStringValue(KeyVaultResourceId); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticKeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticKeyVaultProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticKeyVaultProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticKeyVaultProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticKeyVaultProperties DeserializeElasticKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri keyVaultUri = default; + string keyName = default; + ResourceIdentifier keyVaultResourceId = default; + ElasticKeyVaultStatus? status = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("keyVaultUri"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultUri = new Uri(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyName"u8)) + { + keyName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("keyVaultResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("status"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ElasticKeyVaultStatus(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticKeyVaultProperties(keyVaultUri, keyName, keyVaultResourceId, status, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticKeyVaultProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticKeyVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticKeyVaultProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticKeyVaultProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticKeyVaultProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultProperties.cs new file mode 100644 index 000000000000..ead869138ed3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultProperties.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of key vault. + public partial class ElasticKeyVaultProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticKeyVaultProperties() + { + } + + /// Initializes a new instance of . + /// The Uri of KeyVault. + /// The name of KeyVault key. + /// The resource ID of KeyVault. + /// Status of the KeyVault connection. + /// Keeps track of any properties unknown to the library. + internal ElasticKeyVaultProperties(Uri keyVaultUri, string keyName, ResourceIdentifier keyVaultResourceId, ElasticKeyVaultStatus? status, IDictionary additionalBinaryDataProperties) + { + KeyVaultUri = keyVaultUri; + KeyName = keyName; + KeyVaultResourceId = keyVaultResourceId; + Status = status; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The Uri of KeyVault. + public Uri KeyVaultUri { get; set; } + + /// The name of KeyVault key. + public string KeyName { get; set; } + + /// The resource ID of KeyVault. + public ResourceIdentifier KeyVaultResourceId { get; set; } + + /// Status of the KeyVault connection. + public ElasticKeyVaultStatus? Status { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultStatus.cs new file mode 100644 index 000000000000..92c7f4e76933 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticKeyVaultStatus.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// KeyVault status. + public readonly partial struct ElasticKeyVaultStatus : IEquatable + { + private readonly string _value; + /// KeyVault connection created but not in use. + private const string CreatedValue = "Created"; + /// KeyVault connection in use by SMB Volume. + private const string InUseValue = "InUse"; + /// KeyVault connection Deleted. + private const string DeletedValue = "Deleted"; + /// Error with the KeyVault connection. + private const string ErrorValue = "Error"; + /// KeyVault connection Updating. + private const string UpdatingValue = "Updating"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticKeyVaultStatus(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// KeyVault connection created but not in use. + public static ElasticKeyVaultStatus Created { get; } = new ElasticKeyVaultStatus(CreatedValue); + + /// KeyVault connection in use by SMB Volume. + public static ElasticKeyVaultStatus InUse { get; } = new ElasticKeyVaultStatus(InUseValue); + + /// KeyVault connection Deleted. + public static ElasticKeyVaultStatus Deleted { get; } = new ElasticKeyVaultStatus(DeletedValue); + + /// Error with the KeyVault connection. + public static ElasticKeyVaultStatus Error { get; } = new ElasticKeyVaultStatus(ErrorValue); + + /// KeyVault connection Updating. + public static ElasticKeyVaultStatus Updating { get; } = new ElasticKeyVaultStatus(UpdatingValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticKeyVaultStatus left, ElasticKeyVaultStatus right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticKeyVaultStatus left, ElasticKeyVaultStatus right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticKeyVaultStatus(string value) => new ElasticKeyVaultStatus(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticKeyVaultStatus?(string value) => value == null ? null : new ElasticKeyVaultStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticKeyVaultStatus other && Equals(other); + + /// + public bool Equals(ElasticKeyVaultStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticMountTargetProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticMountTargetProperties.Serialization.cs new file mode 100644 index 000000000000..9aaab4a1d8b1 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticMountTargetProperties.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Net; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Contains all the information needed to mount an elastic volume. + public partial class ElasticMountTargetProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticMountTargetProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(IpAddress)) + { + writer.WritePropertyName("ipAddress"u8); + writer.WriteStringValue(IpAddress.ToString()); + } + if (Optional.IsDefined(SmbServerFqdn)) + { + writer.WritePropertyName("smbServerFqdn"u8); + writer.WriteStringValue(SmbServerFqdn); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticMountTargetProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticMountTargetProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticMountTargetProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticMountTargetProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticMountTargetProperties DeserializeElasticMountTargetProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IPAddress ipAddress = default; + string smbServerFqdn = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("ipAddress"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipAddress = IPAddress.Parse(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbServerFqdn"u8)) + { + smbServerFqdn = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticMountTargetProperties(ipAddress, smbServerFqdn, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticMountTargetProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticMountTargetProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticMountTargetProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticMountTargetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticMountTargetProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticMountTargetProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticMountTargetProperties.cs new file mode 100644 index 000000000000..bb4724a86ae0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticMountTargetProperties.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Contains all the information needed to mount an elastic volume. + public partial class ElasticMountTargetProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ElasticMountTargetProperties() + { + } + + /// Initializes a new instance of . + /// The mount target's IPv4 address, used to mount the volume. + /// The SMB server's Fully Qualified Domain Name, FQDN. + /// Keeps track of any properties unknown to the library. + internal ElasticMountTargetProperties(IPAddress ipAddress, string smbServerFqdn, IDictionary additionalBinaryDataProperties) + { + IpAddress = ipAddress; + SmbServerFqdn = smbServerFqdn; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The mount target's IPv4 address, used to mount the volume. + public IPAddress IpAddress { get; } + + /// The SMB server's Fully Qualified Domain Name, FQDN. + public string SmbServerFqdn { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticNfsv3Access.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticNfsv3Access.cs new file mode 100644 index 000000000000..62039e32f58a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticNfsv3Access.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// NFSv3 access. + public readonly partial struct ElasticNfsv3Access : IEquatable + { + private readonly string _value; + /// Clients can connect to the volume using the NFSv3 protocol. + private const string EnabledValue = "Enabled"; + /// Clients can't connect to the volume using the NFSv3 protocol. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticNfsv3Access(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Clients can connect to the volume using the NFSv3 protocol. + public static ElasticNfsv3Access Enabled { get; } = new ElasticNfsv3Access(EnabledValue); + + /// Clients can't connect to the volume using the NFSv3 protocol. + public static ElasticNfsv3Access Disabled { get; } = new ElasticNfsv3Access(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticNfsv3Access left, ElasticNfsv3Access right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticNfsv3Access left, ElasticNfsv3Access right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticNfsv3Access(string value) => new ElasticNfsv3Access(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticNfsv3Access?(string value) => value == null ? null : new ElasticNfsv3Access(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticNfsv3Access other && Equals(other); + + /// + public bool Equals(ElasticNfsv3Access other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticNfsv4Access.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticNfsv4Access.cs new file mode 100644 index 000000000000..ae71291a9b4e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticNfsv4Access.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// NFSv4 access. + public readonly partial struct ElasticNfsv4Access : IEquatable + { + private readonly string _value; + /// Clients can connect to the volume using the NFSv4 protocol. + private const string EnabledValue = "Enabled"; + /// Clients can't connect to the volume using the NFSv4 protocol. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticNfsv4Access(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Clients can connect to the volume using the NFSv4 protocol. + public static ElasticNfsv4Access Enabled { get; } = new ElasticNfsv4Access(EnabledValue); + + /// Clients can't connect to the volume using the NFSv4 protocol. + public static ElasticNfsv4Access Disabled { get; } = new ElasticNfsv4Access(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticNfsv4Access left, ElasticNfsv4Access right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticNfsv4Access left, ElasticNfsv4Access right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticNfsv4Access(string value) => new ElasticNfsv4Access(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticNfsv4Access?(string value) => value == null ? null : new ElasticNfsv4Access(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticNfsv4Access other && Equals(other); + + /// + public bool Equals(ElasticNfsv4Access other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticPoolEncryptionKeySource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticPoolEncryptionKeySource.cs new file mode 100644 index 000000000000..ebc0f8ac31d6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticPoolEncryptionKeySource.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Pool Encryption Key Source. + public readonly partial struct ElasticPoolEncryptionKeySource : IEquatable + { + private readonly string _value; + /// Represents the encryption key source of Elastic pool is Microsoft.NetApp. + private const string NetAppValue = "NetApp"; + /// Represents the encryption key source of Elastic pool is Microsoft.KeyVault. + private const string KeyVaultValue = "KeyVault"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticPoolEncryptionKeySource(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Represents the encryption key source of Elastic pool is Microsoft.NetApp. + public static ElasticPoolEncryptionKeySource NetApp { get; } = new ElasticPoolEncryptionKeySource(NetAppValue); + + /// Represents the encryption key source of Elastic pool is Microsoft.KeyVault. + public static ElasticPoolEncryptionKeySource KeyVault { get; } = new ElasticPoolEncryptionKeySource(KeyVaultValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticPoolEncryptionKeySource left, ElasticPoolEncryptionKeySource right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticPoolEncryptionKeySource left, ElasticPoolEncryptionKeySource right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticPoolEncryptionKeySource(string value) => new ElasticPoolEncryptionKeySource(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticPoolEncryptionKeySource?(string value) => value == null ? null : new ElasticPoolEncryptionKeySource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticPoolEncryptionKeySource other && Equals(other); + + /// + public bool Equals(ElasticPoolEncryptionKeySource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticProtocolType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticProtocolType.cs new file mode 100644 index 000000000000..90448e315731 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticProtocolType.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Protocol types for elastic volume. + public readonly partial struct ElasticProtocolType : IEquatable + { + private readonly string _value; + /// NFSv3 protocol type. + private const string NFSv3Value = "NFSv3"; + /// NFSv4 protocol type. + private const string NFSv4Value = "NFSv4"; + /// SMB/CIFS protocol type. + private const string SMBValue = "SMB"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticProtocolType(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// NFSv3 protocol type. + public static ElasticProtocolType NFSv3 { get; } = new ElasticProtocolType(NFSv3Value); + + /// NFSv4 protocol type. + public static ElasticProtocolType NFSv4 { get; } = new ElasticProtocolType(NFSv4Value); + + /// SMB/CIFS protocol type. + public static ElasticProtocolType SMB { get; } = new ElasticProtocolType(SMBValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticProtocolType left, ElasticProtocolType right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticProtocolType left, ElasticProtocolType right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticProtocolType(string value) => new ElasticProtocolType(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticProtocolType?(string value) => value == null ? null : new ElasticProtocolType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticProtocolType other && Equals(other); + + /// + public bool Equals(ElasticProtocolType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticResourceAvailabilityStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticResourceAvailabilityStatus.cs new file mode 100644 index 000000000000..fcabecc9c9da --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticResourceAvailabilityStatus.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Current availability status of the resource. + public readonly partial struct ElasticResourceAvailabilityStatus : IEquatable + { + private readonly string _value; + /// The resource is currently Online and accessible. + private const string OnlineValue = "Online"; + /// The resource is currently Offline and not accessible. + private const string OfflineValue = "Offline"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticResourceAvailabilityStatus(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// The resource is currently Online and accessible. + public static ElasticResourceAvailabilityStatus Online { get; } = new ElasticResourceAvailabilityStatus(OnlineValue); + + /// The resource is currently Offline and not accessible. + public static ElasticResourceAvailabilityStatus Offline { get; } = new ElasticResourceAvailabilityStatus(OfflineValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticResourceAvailabilityStatus left, ElasticResourceAvailabilityStatus right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticResourceAvailabilityStatus left, ElasticResourceAvailabilityStatus right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticResourceAvailabilityStatus(string value) => new ElasticResourceAvailabilityStatus(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticResourceAvailabilityStatus?(string value) => value == null ? null : new ElasticResourceAvailabilityStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticResourceAvailabilityStatus other && Equals(other); + + /// + public bool Equals(ElasticResourceAvailabilityStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticRootAccess.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticRootAccess.cs new file mode 100644 index 000000000000..26e1f6385ce2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticRootAccess.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Root access. + public readonly partial struct ElasticRootAccess : IEquatable + { + private readonly string _value; + /// Root user access is enabled for clients affected by this rule. + private const string EnabledValue = "Enabled"; + /// Root user access is disabled for clients affected by this rule. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticRootAccess(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Root user access is enabled for clients affected by this rule. + public static ElasticRootAccess Enabled { get; } = new ElasticRootAccess(EnabledValue); + + /// Root user access is disabled for clients affected by this rule. + public static ElasticRootAccess Disabled { get; } = new ElasticRootAccess(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticRootAccess left, ElasticRootAccess right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticRootAccess left, ElasticRootAccess right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticRootAccess(string value) => new ElasticRootAccess(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticRootAccess?(string value) => value == null ? null : new ElasticRootAccess(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticRootAccess other && Equals(other); + + /// + public bool Equals(ElasticRootAccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticServiceLevel.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticServiceLevel.cs new file mode 100644 index 000000000000..16bcb5826d3f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticServiceLevel.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Service level for elastic capacity pool. + public readonly partial struct ElasticServiceLevel : IEquatable + { + private readonly string _value; + /// Zone redundant storage service level. + private const string ZoneRedundantValue = "ZoneRedundant"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticServiceLevel(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Zone redundant storage service level. + public static ElasticServiceLevel ZoneRedundant { get; } = new ElasticServiceLevel(ZoneRedundantValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticServiceLevel left, ElasticServiceLevel right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticServiceLevel left, ElasticServiceLevel right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticServiceLevel(string value) => new ElasticServiceLevel(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticServiceLevel?(string value) => value == null ? null : new ElasticServiceLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticServiceLevel other && Equals(other); + + /// + public bool Equals(ElasticServiceLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbEncryption.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbEncryption.cs new file mode 100644 index 000000000000..242f45f50b8e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbEncryption.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// SMB encryption. + public readonly partial struct ElasticSmbEncryption : IEquatable + { + private readonly string _value; + /// Value indicating the SMB encryption is enabled. + private const string EnabledValue = "Enabled"; + /// Value indicating the SMB encryption is disabled. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticSmbEncryption(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Value indicating the SMB encryption is enabled. + public static ElasticSmbEncryption Enabled { get; } = new ElasticSmbEncryption(EnabledValue); + + /// Value indicating the SMB encryption is disabled. + public static ElasticSmbEncryption Disabled { get; } = new ElasticSmbEncryption(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticSmbEncryption left, ElasticSmbEncryption right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticSmbEncryption left, ElasticSmbEncryption right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticSmbEncryption(string value) => new ElasticSmbEncryption(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticSmbEncryption?(string value) => value == null ? null : new ElasticSmbEncryption(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticSmbEncryption other && Equals(other); + + /// + public bool Equals(ElasticSmbEncryption other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbPatchProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbPatchProperties.Serialization.cs new file mode 100644 index 000000000000..7228fadc4fc2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbPatchProperties.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// SMB Patch Properties. + internal partial class ElasticSmbPatchProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSmbPatchProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SmbEncryption)) + { + writer.WritePropertyName("smbEncryption"u8); + writer.WriteStringValue(SmbEncryption.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSmbPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSmbPatchProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSmbPatchProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSmbPatchProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSmbPatchProperties DeserializeElasticSmbPatchProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ElasticSmbEncryption? smbEncryption = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("smbEncryption"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbEncryption = new ElasticSmbEncryption(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSmbPatchProperties(smbEncryption, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSmbPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSmbPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSmbPatchProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSmbPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSmbPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbPatchProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbPatchProperties.cs new file mode 100644 index 000000000000..e37c87da6db9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbPatchProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// SMB Patch Properties. + internal partial class ElasticSmbPatchProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticSmbPatchProperties() + { + } + + /// Initializes a new instance of . + /// Used to enable or disable encryption for in-flight SMB data volume. This flag can be modified during Elastic volume update operation as well. Only applicable for SMB protocol Elastic volumes. + /// Keeps track of any properties unknown to the library. + internal ElasticSmbPatchProperties(ElasticSmbEncryption? smbEncryption, IDictionary additionalBinaryDataProperties) + { + SmbEncryption = smbEncryption; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Used to enable or disable encryption for in-flight SMB data volume. This flag can be modified during Elastic volume update operation as well. Only applicable for SMB protocol Elastic volumes. + public ElasticSmbEncryption? SmbEncryption { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbProperties.Serialization.cs new file mode 100644 index 000000000000..ca29c9a6d660 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbProperties.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// SMB Properties. + internal partial class ElasticSmbProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSmbProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SmbEncryption)) + { + writer.WritePropertyName("smbEncryption"u8); + writer.WriteStringValue(SmbEncryption.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSmbProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSmbProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSmbProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSmbProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSmbProperties DeserializeElasticSmbProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ElasticSmbEncryption? smbEncryption = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("smbEncryption"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbEncryption = new ElasticSmbEncryption(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSmbProperties(smbEncryption, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSmbProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSmbProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSmbProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSmbProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSmbProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbProperties.cs new file mode 100644 index 000000000000..a6959ad36ea5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSmbProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// SMB Properties. + internal partial class ElasticSmbProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticSmbProperties() + { + } + + /// Initializes a new instance of . + /// Used to enable or disable encryption for in-flight SMB data volume. This flag can be modified during Elastic volume update operation as well. Only applicable for SMB protocol Elastic volumes. + /// Keeps track of any properties unknown to the library. + internal ElasticSmbProperties(ElasticSmbEncryption? smbEncryption, IDictionary additionalBinaryDataProperties) + { + SmbEncryption = smbEncryption; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Used to enable or disable encryption for in-flight SMB data volume. This flag can be modified during Elastic volume update operation as well. Only applicable for SMB protocol Elastic volumes. + public ElasticSmbEncryption? SmbEncryption { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotListResult.Serialization.cs new file mode 100644 index 000000000000..1faa7d3e0a27 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticSnapshot list operation. + internal partial class ElasticSnapshotListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticSnapshotListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ElasticSnapshotData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotListResult DeserializeElasticSnapshotListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticSnapshotData.DeserializeElasticSnapshotData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ElasticSnapshotListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticSnapshotListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotListResult.cs new file mode 100644 index 000000000000..b10746b79580 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticSnapshot list operation. + internal partial class ElasticSnapshotListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ElasticSnapshot items on this page. + internal ElasticSnapshotListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ElasticSnapshot items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ElasticSnapshotListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ElasticSnapshot items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyDailySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyDailySchedule.Serialization.cs new file mode 100644 index 000000000000..e4dfd6a55f6c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyDailySchedule.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Daily Schedule properties used to create NetApp snapshot policy. + public partial class ElasticSnapshotPolicyDailySchedule : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyDailySchedule)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotsToKeep)) + { + writer.WritePropertyName("snapshotsToKeep"u8); + writer.WriteNumberValue(SnapshotsToKeep.Value); + } + if (Optional.IsDefined(Hour)) + { + writer.WritePropertyName("hour"u8); + writer.WriteNumberValue(Hour.Value); + } + if (Optional.IsDefined(Minute)) + { + writer.WritePropertyName("minute"u8); + writer.WriteNumberValue(Minute.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotPolicyDailySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyDailySchedule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyDailySchedule)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotPolicyDailySchedule(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotPolicyDailySchedule DeserializeElasticSnapshotPolicyDailySchedule(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? snapshotsToKeep = default; + int? hour = default; + int? minute = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("hour"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hour = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("minute"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minute = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotPolicyDailySchedule(snapshotsToKeep, hour, minute, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyDailySchedule)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotPolicyDailySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyDailySchedule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotPolicyDailySchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyDailySchedule)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyDailySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyDailySchedule.cs new file mode 100644 index 000000000000..29dea0d79f42 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyDailySchedule.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Daily Schedule properties used to create NetApp snapshot policy. + public partial class ElasticSnapshotPolicyDailySchedule + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticSnapshotPolicyDailySchedule() + { + } + + /// Initializes a new instance of . + /// Daily snapshot count to keep. + /// Indicates which hour in UTC timezone a snapshot should be taken. + /// Indicates which minute snapshot should be taken. + /// Keeps track of any properties unknown to the library. + internal ElasticSnapshotPolicyDailySchedule(int? snapshotsToKeep, int? hour, int? minute, IDictionary additionalBinaryDataProperties) + { + SnapshotsToKeep = snapshotsToKeep; + Hour = hour; + Minute = minute; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Daily snapshot count to keep. + public int? SnapshotsToKeep { get; set; } + + /// Indicates which hour in UTC timezone a snapshot should be taken. + public int? Hour { get; set; } + + /// Indicates which minute snapshot should be taken. + public int? Minute { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyHourlySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyHourlySchedule.Serialization.cs new file mode 100644 index 000000000000..67895c6f724b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyHourlySchedule.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Hourly Schedule properties used to create NetApp snapshot policy. + public partial class ElasticSnapshotPolicyHourlySchedule : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyHourlySchedule)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotsToKeep)) + { + writer.WritePropertyName("snapshotsToKeep"u8); + writer.WriteNumberValue(SnapshotsToKeep.Value); + } + if (Optional.IsDefined(Minute)) + { + writer.WritePropertyName("minute"u8); + writer.WriteNumberValue(Minute.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotPolicyHourlySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyHourlySchedule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyHourlySchedule)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotPolicyHourlySchedule(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotPolicyHourlySchedule DeserializeElasticSnapshotPolicyHourlySchedule(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? snapshotsToKeep = default; + int? minute = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("minute"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minute = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotPolicyHourlySchedule(snapshotsToKeep, minute, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyHourlySchedule)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotPolicyHourlySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyHourlySchedule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotPolicyHourlySchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyHourlySchedule)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyHourlySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyHourlySchedule.cs new file mode 100644 index 000000000000..070b7f24ca17 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyHourlySchedule.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Hourly Schedule properties used to create NetApp snapshot policy. + public partial class ElasticSnapshotPolicyHourlySchedule + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticSnapshotPolicyHourlySchedule() + { + } + + /// Initializes a new instance of . + /// Hourly snapshot count to keep. + /// Indicates which minute snapshot should be taken. + /// Keeps track of any properties unknown to the library. + internal ElasticSnapshotPolicyHourlySchedule(int? snapshotsToKeep, int? minute, IDictionary additionalBinaryDataProperties) + { + SnapshotsToKeep = snapshotsToKeep; + Minute = minute; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Hourly snapshot count to keep. + public int? SnapshotsToKeep { get; set; } + + /// Indicates which minute snapshot should be taken. + public int? Minute { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyListResult.Serialization.cs new file mode 100644 index 000000000000..9879fb2b77ff --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticSnapshotPolicy list operation. + internal partial class ElasticSnapshotPolicyListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticSnapshotPolicyListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ElasticSnapshotPolicyData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotPolicyListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotPolicyListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotPolicyListResult DeserializeElasticSnapshotPolicyListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticSnapshotPolicyData.DeserializeElasticSnapshotPolicyData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotPolicyListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotPolicyListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotPolicyListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ElasticSnapshotPolicyListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticSnapshotPolicyListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyListResult.cs new file mode 100644 index 000000000000..ed89cb884804 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticSnapshotPolicy list operation. + internal partial class ElasticSnapshotPolicyListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ElasticSnapshotPolicy items on this page. + internal ElasticSnapshotPolicyListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ElasticSnapshotPolicy items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ElasticSnapshotPolicyListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ElasticSnapshotPolicy items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyMonthlySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyMonthlySchedule.Serialization.cs new file mode 100644 index 000000000000..b848d155a089 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyMonthlySchedule.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Monthly Schedule properties used to create NetApp snapshot policy. + public partial class ElasticSnapshotPolicyMonthlySchedule : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyMonthlySchedule)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotsToKeep)) + { + writer.WritePropertyName("snapshotsToKeep"u8); + writer.WriteNumberValue(SnapshotsToKeep.Value); + } + if (Optional.IsCollectionDefined(DaysOfMonth)) + { + writer.WritePropertyName("daysOfMonth"u8); + writer.WriteStartArray(); + foreach (int item in DaysOfMonth) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Hour)) + { + writer.WritePropertyName("hour"u8); + writer.WriteNumberValue(Hour.Value); + } + if (Optional.IsDefined(Minute)) + { + writer.WritePropertyName("minute"u8); + writer.WriteNumberValue(Minute.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotPolicyMonthlySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyMonthlySchedule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyMonthlySchedule)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotPolicyMonthlySchedule(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotPolicyMonthlySchedule DeserializeElasticSnapshotPolicyMonthlySchedule(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? snapshotsToKeep = default; + IList daysOfMonth = default; + int? hour = default; + int? minute = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("daysOfMonth"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + daysOfMonth = array; + continue; + } + if (prop.NameEquals("hour"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hour = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("minute"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minute = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotPolicyMonthlySchedule(snapshotsToKeep, daysOfMonth ?? new ChangeTrackingList(), hour, minute, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyMonthlySchedule)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotPolicyMonthlySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyMonthlySchedule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotPolicyMonthlySchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyMonthlySchedule)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyMonthlySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyMonthlySchedule.cs new file mode 100644 index 000000000000..aff660090cb5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyMonthlySchedule.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Monthly Schedule properties used to create NetApp snapshot policy. + public partial class ElasticSnapshotPolicyMonthlySchedule + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticSnapshotPolicyMonthlySchedule() + { + DaysOfMonth = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Monthly snapshot count to keep. + /// Indicates which days of the month snapshot (1-31) should be taken, accepts a list of integers. + /// Indicates which hour in UTC timezone a snapshot should be taken. + /// Indicates which minute snapshot should be taken. + /// Keeps track of any properties unknown to the library. + internal ElasticSnapshotPolicyMonthlySchedule(int? snapshotsToKeep, IList daysOfMonth, int? hour, int? minute, IDictionary additionalBinaryDataProperties) + { + SnapshotsToKeep = snapshotsToKeep; + DaysOfMonth = daysOfMonth; + Hour = hour; + Minute = minute; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Monthly snapshot count to keep. + public int? SnapshotsToKeep { get; set; } + + /// Indicates which days of the month snapshot (1-31) should be taken, accepts a list of integers. + public IList DaysOfMonth { get; } + + /// Indicates which hour in UTC timezone a snapshot should be taken. + public int? Hour { get; set; } + + /// Indicates which minute snapshot should be taken. + public int? Minute { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyProperties.Serialization.cs new file mode 100644 index 000000000000..bbe48d7097a8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyProperties.Serialization.cs @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Snapshot policy properties. + public partial class ElasticSnapshotPolicyProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(HourlySchedule)) + { + writer.WritePropertyName("hourlySchedule"u8); + writer.WriteObjectValue(HourlySchedule, options); + } + if (Optional.IsDefined(DailySchedule)) + { + writer.WritePropertyName("dailySchedule"u8); + writer.WriteObjectValue(DailySchedule, options); + } + if (Optional.IsDefined(WeeklySchedule)) + { + writer.WritePropertyName("weeklySchedule"u8); + writer.WriteObjectValue(WeeklySchedule, options); + } + if (Optional.IsDefined(MonthlySchedule)) + { + writer.WritePropertyName("monthlySchedule"u8); + writer.WriteObjectValue(MonthlySchedule, options); + } + if (Optional.IsDefined(PolicyStatus)) + { + writer.WritePropertyName("policyStatus"u8); + writer.WriteStringValue(PolicyStatus.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotPolicyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotPolicyProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotPolicyProperties DeserializeElasticSnapshotPolicyProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ElasticSnapshotPolicyHourlySchedule hourlySchedule = default; + ElasticSnapshotPolicyDailySchedule dailySchedule = default; + ElasticSnapshotPolicyWeeklySchedule weeklySchedule = default; + ElasticSnapshotPolicyMonthlySchedule monthlySchedule = default; + PolicyStatus? policyStatus = default; + Models.NetAppProvisioningState? provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("hourlySchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hourlySchedule = ElasticSnapshotPolicyHourlySchedule.DeserializeElasticSnapshotPolicyHourlySchedule(prop.Value, options); + continue; + } + if (prop.NameEquals("dailySchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dailySchedule = ElasticSnapshotPolicyDailySchedule.DeserializeElasticSnapshotPolicyDailySchedule(prop.Value, options); + continue; + } + if (prop.NameEquals("weeklySchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + weeklySchedule = ElasticSnapshotPolicyWeeklySchedule.DeserializeElasticSnapshotPolicyWeeklySchedule(prop.Value, options); + continue; + } + if (prop.NameEquals("monthlySchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlySchedule = ElasticSnapshotPolicyMonthlySchedule.DeserializeElasticSnapshotPolicyMonthlySchedule(prop.Value, options); + continue; + } + if (prop.NameEquals("policyStatus"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyStatus = new PolicyStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotPolicyProperties( + hourlySchedule, + dailySchedule, + weeklySchedule, + monthlySchedule, + policyStatus, + provisioningState, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotPolicyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotPolicyProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyProperties.cs new file mode 100644 index 000000000000..2750c1cd0b27 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyProperties.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Snapshot policy properties. + public partial class ElasticSnapshotPolicyProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticSnapshotPolicyProperties() + { + } + + /// Initializes a new instance of . + /// Schedule for hourly snapshots. + /// Schedule for daily snapshots. + /// Schedule for weekly snapshots. + /// Schedule for monthly snapshots. + /// Configures if the snapshot policy is enabled on the volumes connected to the policy. + /// Azure lifecycle management. + /// Keeps track of any properties unknown to the library. + internal ElasticSnapshotPolicyProperties(ElasticSnapshotPolicyHourlySchedule hourlySchedule, ElasticSnapshotPolicyDailySchedule dailySchedule, ElasticSnapshotPolicyWeeklySchedule weeklySchedule, ElasticSnapshotPolicyMonthlySchedule monthlySchedule, PolicyStatus? policyStatus, Models.NetAppProvisioningState? provisioningState, IDictionary additionalBinaryDataProperties) + { + HourlySchedule = hourlySchedule; + DailySchedule = dailySchedule; + WeeklySchedule = weeklySchedule; + MonthlySchedule = monthlySchedule; + PolicyStatus = policyStatus; + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Schedule for hourly snapshots. + public ElasticSnapshotPolicyHourlySchedule HourlySchedule { get; set; } + + /// Schedule for daily snapshots. + public ElasticSnapshotPolicyDailySchedule DailySchedule { get; set; } + + /// Schedule for weekly snapshots. + public ElasticSnapshotPolicyWeeklySchedule WeeklySchedule { get; set; } + + /// Schedule for monthly snapshots. + public ElasticSnapshotPolicyMonthlySchedule MonthlySchedule { get; set; } + + /// Configures if the snapshot policy is enabled on the volumes connected to the policy. + public PolicyStatus? PolicyStatus { get; set; } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyVolumeList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyVolumeList.Serialization.cs new file mode 100644 index 000000000000..07d02e5dcfab --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyVolumeList.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Volumes associated with snapshot policy. + internal partial class ElasticSnapshotPolicyVolumeList : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticSnapshotPolicyVolumeList() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyVolumeList)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ElasticVolumeData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotPolicyVolumeList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyVolumeList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyVolumeList)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotPolicyVolumeList(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotPolicyVolumeList DeserializeElasticSnapshotPolicyVolumeList(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticVolumeData.DeserializeElasticVolumeData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotPolicyVolumeList(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyVolumeList)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotPolicyVolumeList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyVolumeList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotPolicyVolumeList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyVolumeList)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ElasticSnapshotPolicyVolumeList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticSnapshotPolicyVolumeList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyVolumeList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyVolumeList.cs new file mode 100644 index 000000000000..c91e90f57c4f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyVolumeList.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Volumes associated with snapshot policy. + internal partial class ElasticSnapshotPolicyVolumeList + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ElasticVolume items on this page. + internal ElasticSnapshotPolicyVolumeList(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ElasticVolume items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ElasticSnapshotPolicyVolumeList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ElasticVolume items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyWeeklySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyWeeklySchedule.Serialization.cs new file mode 100644 index 000000000000..98524363454f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyWeeklySchedule.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Weekly Schedule properties used to create NetApp snapshot policy. + public partial class ElasticSnapshotPolicyWeeklySchedule : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyWeeklySchedule)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotsToKeep)) + { + writer.WritePropertyName("snapshotsToKeep"u8); + writer.WriteNumberValue(SnapshotsToKeep.Value); + } + if (Optional.IsCollectionDefined(Days)) + { + writer.WritePropertyName("days"u8); + writer.WriteStartArray(); + foreach (DayOfWeek item in Days) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Hour)) + { + writer.WritePropertyName("hour"u8); + writer.WriteNumberValue(Hour.Value); + } + if (Optional.IsDefined(Minute)) + { + writer.WritePropertyName("minute"u8); + writer.WriteNumberValue(Minute.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotPolicyWeeklySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyWeeklySchedule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyWeeklySchedule)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotPolicyWeeklySchedule(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotPolicyWeeklySchedule DeserializeElasticSnapshotPolicyWeeklySchedule(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? snapshotsToKeep = default; + IList days = default; + int? hour = default; + int? minute = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("days"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(new DayOfWeek(item.GetString())); + } + days = array; + continue; + } + if (prop.NameEquals("hour"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hour = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("minute"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minute = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotPolicyWeeklySchedule(snapshotsToKeep, days ?? new ChangeTrackingList(), hour, minute, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyWeeklySchedule)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotPolicyWeeklySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotPolicyWeeklySchedule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotPolicyWeeklySchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotPolicyWeeklySchedule)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyWeeklySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyWeeklySchedule.cs new file mode 100644 index 000000000000..5af33e135f02 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotPolicyWeeklySchedule.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Weekly Schedule properties used to create NetApp snapshot policy. + public partial class ElasticSnapshotPolicyWeeklySchedule + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticSnapshotPolicyWeeklySchedule() + { + Days = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Weekly snapshot count to keep. + /// Indicates which weekday(s) snapshot(s) should be taken, accepts a list of week day names in english. + /// Indicates which hour in UTC timezone a snapshot should be taken. + /// Indicates which minute snapshot should be taken. + /// Keeps track of any properties unknown to the library. + internal ElasticSnapshotPolicyWeeklySchedule(int? snapshotsToKeep, IList days, int? hour, int? minute, IDictionary additionalBinaryDataProperties) + { + SnapshotsToKeep = snapshotsToKeep; + Days = days; + Hour = hour; + Minute = minute; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Weekly snapshot count to keep. + public int? SnapshotsToKeep { get; set; } + + /// Indicates which weekday(s) snapshot(s) should be taken, accepts a list of week day names in english. + public IList Days { get; } + + /// Indicates which hour in UTC timezone a snapshot should be taken. + public int? Hour { get; set; } + + /// Indicates which minute snapshot should be taken. + public int? Minute { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotProperties.Serialization.cs new file mode 100644 index 000000000000..481b88f4d8fa --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotProperties.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Snapshot properties. + internal partial class ElasticSnapshotProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticSnapshotProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticSnapshotProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticSnapshotProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticSnapshotProperties DeserializeElasticSnapshotProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Models.NetAppProvisioningState? provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticSnapshotProperties(provisioningState, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticSnapshotProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticSnapshotProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticSnapshotProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticSnapshotProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticSnapshotProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotProperties.cs new file mode 100644 index 000000000000..211505bd42a3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticSnapshotProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Snapshot properties. + internal partial class ElasticSnapshotProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticSnapshotProperties() + { + } + + /// Initializes a new instance of . + /// Azure lifecycle management. + /// Keeps track of any properties unknown to the library. + internal ElasticSnapshotProperties(Models.NetAppProvisioningState? provisioningState, IDictionary additionalBinaryDataProperties) + { + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticUnixAccessRule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticUnixAccessRule.cs new file mode 100644 index 000000000000..4ff1dbe83b01 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticUnixAccessRule.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Unix access rule. + public readonly partial struct ElasticUnixAccessRule : IEquatable + { + private readonly string _value; + /// Clients connecting with this rule will only have read access to the volume. + private const string ReadOnlyValue = "ReadOnly"; + /// Clients connecting with this rule will have full read and write access to the volume. + private const string ReadWriteValue = "ReadWrite"; + /// Clients connecting with this rule will have no access to the volume. + private const string NoAccessValue = "NoAccess"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticUnixAccessRule(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Clients connecting with this rule will only have read access to the volume. + public static ElasticUnixAccessRule ReadOnly { get; } = new ElasticUnixAccessRule(ReadOnlyValue); + + /// Clients connecting with this rule will have full read and write access to the volume. + public static ElasticUnixAccessRule ReadWrite { get; } = new ElasticUnixAccessRule(ReadWriteValue); + + /// Clients connecting with this rule will have no access to the volume. + public static ElasticUnixAccessRule NoAccess { get; } = new ElasticUnixAccessRule(NoAccessValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticUnixAccessRule left, ElasticUnixAccessRule right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticUnixAccessRule left, ElasticUnixAccessRule right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticUnixAccessRule(string value) => new ElasticUnixAccessRule(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticUnixAccessRule?(string value) => value == null ? null : new ElasticUnixAccessRule(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticUnixAccessRule other && Equals(other); + + /// + public bool Equals(ElasticUnixAccessRule other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeBackupProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeBackupProperties.Serialization.cs new file mode 100644 index 000000000000..54c8158ffd54 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeBackupProperties.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Volume Backup Properties. + public partial class ElasticVolumeBackupProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeBackupProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(ElasticBackupPolicyResourceId)) + { + writer.WritePropertyName("elasticBackupPolicyResourceId"u8); + writer.WriteStringValue(ElasticBackupPolicyResourceId); + } + if (Optional.IsDefined(PolicyEnforcement)) + { + writer.WritePropertyName("policyEnforcement"u8); + writer.WriteStringValue(PolicyEnforcement.Value.ToString()); + } + if (Optional.IsDefined(ElasticBackupVaultResourceId)) + { + writer.WritePropertyName("elasticBackupVaultResourceId"u8); + writer.WriteStringValue(ElasticBackupVaultResourceId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticVolumeBackupProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticVolumeBackupProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeBackupProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVolumeBackupProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticVolumeBackupProperties DeserializeElasticVolumeBackupProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier elasticBackupPolicyResourceId = default; + ElasticVolumePolicyEnforcement? policyEnforcement = default; + ResourceIdentifier elasticBackupVaultResourceId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("elasticBackupPolicyResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + elasticBackupPolicyResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("policyEnforcement"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyEnforcement = new ElasticVolumePolicyEnforcement(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("elasticBackupVaultResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + elasticBackupVaultResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticVolumeBackupProperties(elasticBackupPolicyResourceId, policyEnforcement, elasticBackupVaultResourceId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVolumeBackupProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticVolumeBackupProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticVolumeBackupProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticVolumeBackupProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVolumeBackupProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeBackupProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeBackupProperties.cs new file mode 100644 index 000000000000..435b749f8574 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeBackupProperties.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Volume Backup Properties. + public partial class ElasticVolumeBackupProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticVolumeBackupProperties() + { + } + + /// Initializes a new instance of . + /// ResourceId used to identify Elastic Backup Policy. + /// The property to decide policy is enforced or not on the volume. + /// ResourceId used to identify Elastic Backup Vault. + /// Keeps track of any properties unknown to the library. + internal ElasticVolumeBackupProperties(ResourceIdentifier elasticBackupPolicyResourceId, ElasticVolumePolicyEnforcement? policyEnforcement, ResourceIdentifier elasticBackupVaultResourceId, IDictionary additionalBinaryDataProperties) + { + ElasticBackupPolicyResourceId = elasticBackupPolicyResourceId; + PolicyEnforcement = policyEnforcement; + ElasticBackupVaultResourceId = elasticBackupVaultResourceId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// ResourceId used to identify Elastic Backup Policy. + public ResourceIdentifier ElasticBackupPolicyResourceId { get; set; } + + /// The property to decide policy is enforced or not on the volume. + public ElasticVolumePolicyEnforcement? PolicyEnforcement { get; set; } + + /// ResourceId used to identify Elastic Backup Vault. + public ResourceIdentifier ElasticBackupVaultResourceId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionPatchProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionPatchProperties.Serialization.cs new file mode 100644 index 000000000000..55b2c8d6c070 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionPatchProperties.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Data protection configuration option for updating the volume, including snapshot policies and backup. + public partial class ElasticVolumeDataProtectionPatchProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeDataProtectionPatchProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Snapshot)) + { + writer.WritePropertyName("snapshot"u8); + writer.WriteObjectValue(Snapshot, options); + } + if (Optional.IsDefined(Backup)) + { + writer.WritePropertyName("backup"u8); + writer.WriteObjectValue(Backup, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticVolumeDataProtectionPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticVolumeDataProtectionPatchProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeDataProtectionPatchProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVolumeDataProtectionPatchProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticVolumeDataProtectionPatchProperties DeserializeElasticVolumeDataProtectionPatchProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ElasticVolumeSnapshotProperties snapshot = default; + ElasticVolumeBackupProperties backup = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshot"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshot = ElasticVolumeSnapshotProperties.DeserializeElasticVolumeSnapshotProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("backup"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backup = ElasticVolumeBackupProperties.DeserializeElasticVolumeBackupProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticVolumeDataProtectionPatchProperties(snapshot, backup, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVolumeDataProtectionPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticVolumeDataProtectionPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticVolumeDataProtectionPatchProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticVolumeDataProtectionPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVolumeDataProtectionPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionPatchProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionPatchProperties.cs new file mode 100644 index 000000000000..ef2d1c40c7e0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionPatchProperties.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Data protection configuration option for updating the volume, including snapshot policies and backup. + public partial class ElasticVolumeDataProtectionPatchProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticVolumeDataProtectionPatchProperties() + { + } + + /// Initializes a new instance of . + /// Used to apply a snapshot policy to a volume. + /// Used to configure backups on an elastic volume. + /// Keeps track of any properties unknown to the library. + internal ElasticVolumeDataProtectionPatchProperties(ElasticVolumeSnapshotProperties snapshot, ElasticVolumeBackupProperties backup, IDictionary additionalBinaryDataProperties) + { + Snapshot = snapshot; + Backup = backup; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Used to apply a snapshot policy to a volume. + internal ElasticVolumeSnapshotProperties Snapshot { get; set; } + + /// Used to configure backups on an elastic volume. + public ElasticVolumeBackupProperties Backup { get; set; } + + /// Snapshot Policy ResourceId. + public ResourceIdentifier SnapshotPolicyResourceId + { + get + { + return Snapshot is null ? default : Snapshot.SnapshotPolicyResourceId; + } + set + { + if (Snapshot is null) + { + Snapshot = new ElasticVolumeSnapshotProperties(); + } + Snapshot.SnapshotPolicyResourceId = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionProperties.Serialization.cs new file mode 100644 index 000000000000..ac6a4b807ad2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionProperties.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Data protection configuration option for the volume, including snapshot policies and backup. + public partial class ElasticVolumeDataProtectionProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeDataProtectionProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Snapshot)) + { + writer.WritePropertyName("snapshot"u8); + writer.WriteObjectValue(Snapshot, options); + } + if (Optional.IsDefined(Backup)) + { + writer.WritePropertyName("backup"u8); + writer.WriteObjectValue(Backup, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticVolumeDataProtectionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticVolumeDataProtectionProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeDataProtectionProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVolumeDataProtectionProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticVolumeDataProtectionProperties DeserializeElasticVolumeDataProtectionProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ElasticVolumeSnapshotProperties snapshot = default; + ElasticVolumeBackupProperties backup = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshot"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshot = ElasticVolumeSnapshotProperties.DeserializeElasticVolumeSnapshotProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("backup"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backup = ElasticVolumeBackupProperties.DeserializeElasticVolumeBackupProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticVolumeDataProtectionProperties(snapshot, backup, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVolumeDataProtectionProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticVolumeDataProtectionProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticVolumeDataProtectionProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticVolumeDataProtectionProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVolumeDataProtectionProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionProperties.cs new file mode 100644 index 000000000000..89670c3a90b9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeDataProtectionProperties.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Data protection configuration option for the volume, including snapshot policies and backup. + public partial class ElasticVolumeDataProtectionProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticVolumeDataProtectionProperties() + { + } + + /// Initializes a new instance of . + /// Used to apply a snapshot policy to a volume. + /// Used to configure backups on an elastic volume. + /// Keeps track of any properties unknown to the library. + internal ElasticVolumeDataProtectionProperties(ElasticVolumeSnapshotProperties snapshot, ElasticVolumeBackupProperties backup, IDictionary additionalBinaryDataProperties) + { + Snapshot = snapshot; + Backup = backup; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Used to apply a snapshot policy to a volume. + internal ElasticVolumeSnapshotProperties Snapshot { get; set; } + + /// Used to configure backups on an elastic volume. + public ElasticVolumeBackupProperties Backup { get; set; } + + /// Snapshot Policy ResourceId. + public ResourceIdentifier SnapshotPolicyResourceId + { + get + { + return Snapshot is null ? default : Snapshot.SnapshotPolicyResourceId; + } + set + { + if (Snapshot is null) + { + Snapshot = new ElasticVolumeSnapshotProperties(); + } + Snapshot.SnapshotPolicyResourceId = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeListResult.Serialization.cs new file mode 100644 index 000000000000..59334870fac5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticVolume list operation. + internal partial class ElasticVolumeListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticVolumeListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ElasticVolumeData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticVolumeListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticVolumeListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVolumeListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticVolumeListResult DeserializeElasticVolumeListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticVolumeData.DeserializeElasticVolumeData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticVolumeListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVolumeListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticVolumeListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticVolumeListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticVolumeListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVolumeListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ElasticVolumeListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeElasticVolumeListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeListResult.cs new file mode 100644 index 000000000000..b319971ec86b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response of a ElasticVolume list operation. + internal partial class ElasticVolumeListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The ElasticVolume items on this page. + internal ElasticVolumeListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ElasticVolume items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ElasticVolumeListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The ElasticVolume items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePatch.Serialization.cs new file mode 100644 index 000000000000..e652ba8ed033 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePatch.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The type used for update operations of the ElasticVolume. + public partial class ElasticVolumePatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumePatch)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticVolumePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticVolumePatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumePatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVolumePatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticVolumePatch DeserializeElasticVolumePatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + ElasticVolumeUpdateProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ElasticVolumeUpdateProperties.DeserializeElasticVolumeUpdateProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticVolumePatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVolumePatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticVolumePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticVolumePatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticVolumePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVolumePatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticVolumePatch elasticVolumePatch) + { + if (elasticVolumePatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticVolumePatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePatch.cs new file mode 100644 index 000000000000..24de22042fd3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePatch.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The type used for update operations of the ElasticVolume. + public partial class ElasticVolumePatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticVolumePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal ElasticVolumePatch(IDictionary tags, ElasticVolumeUpdateProperties properties, IDictionary additionalBinaryDataProperties) + { + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource tags. + public IDictionary Tags { get; } + + /// The resource-specific properties for this resource. + public ElasticVolumeUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePolicyEnforcement.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePolicyEnforcement.cs new file mode 100644 index 000000000000..edb0afc76ed2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumePolicyEnforcement.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Policy enforcement. + public readonly partial struct ElasticVolumePolicyEnforcement : IEquatable + { + private readonly string _value; + /// Value indicating the policy is enforced on the volume. + private const string EnforcedValue = "Enforced"; + /// Value indicating the policy is not enforced on the volume. + private const string NotEnforcedValue = "NotEnforced"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticVolumePolicyEnforcement(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Value indicating the policy is enforced on the volume. + public static ElasticVolumePolicyEnforcement Enforced { get; } = new ElasticVolumePolicyEnforcement(EnforcedValue); + + /// Value indicating the policy is not enforced on the volume. + public static ElasticVolumePolicyEnforcement NotEnforced { get; } = new ElasticVolumePolicyEnforcement(NotEnforcedValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticVolumePolicyEnforcement left, ElasticVolumePolicyEnforcement right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticVolumePolicyEnforcement left, ElasticVolumePolicyEnforcement right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticVolumePolicyEnforcement(string value) => new ElasticVolumePolicyEnforcement(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticVolumePolicyEnforcement?(string value) => value == null ? null : new ElasticVolumePolicyEnforcement(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticVolumePolicyEnforcement other && Equals(other); + + /// + public bool Equals(ElasticVolumePolicyEnforcement other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeProperties.Serialization.cs new file mode 100644 index 000000000000..a5815dc61a8a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeProperties.Serialization.cs @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Volume properties. + public partial class ElasticVolumeProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ElasticVolumeProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeProperties)} does not support writing '{format}' format."); + } + writer.WritePropertyName("filePath"u8); + writer.WriteStringValue(FilePath); + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size); + if (Optional.IsDefined(ExportPolicy)) + { + writer.WritePropertyName("exportPolicy"u8); + writer.WriteObjectValue(ExportPolicy, options); + } + writer.WritePropertyName("protocolTypes"u8); + writer.WriteStartArray(); + foreach (ElasticProtocolType item in ProtocolTypes) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(AvailabilityStatus)) + { + writer.WritePropertyName("availabilityStatus"u8); + writer.WriteStringValue(AvailabilityStatus.Value.ToString()); + } + if (Optional.IsDefined(SnapshotResourceId)) + { + writer.WritePropertyName("snapshotResourceId"u8); + writer.WriteStringValue(SnapshotResourceId); + } + if (options.Format != "W" && Optional.IsCollectionDefined(MountTargets)) + { + writer.WritePropertyName("mountTargets"u8); + writer.WriteStartArray(); + foreach (ElasticMountTargetProperties item in MountTargets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DataProtection)) + { + writer.WritePropertyName("dataProtection"u8); + writer.WriteObjectValue(DataProtection, options); + } + if (Optional.IsDefined(SnapshotDirectoryVisibility)) + { + writer.WritePropertyName("snapshotDirectoryVisibility"u8); + writer.WriteStringValue(SnapshotDirectoryVisibility.Value.ToString()); + } + if (Optional.IsDefined(SmbProperties)) + { + writer.WritePropertyName("smbProperties"u8); + writer.WriteObjectValue(SmbProperties, options); + } + if (Optional.IsDefined(BackupResourceId)) + { + writer.WritePropertyName("backupResourceId"u8); + writer.WriteStringValue(BackupResourceId); + } + if (options.Format != "W" && Optional.IsDefined(RestorationState)) + { + writer.WritePropertyName("restorationState"u8); + writer.WriteStringValue(RestorationState.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticVolumeProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticVolumeProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVolumeProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticVolumeProperties DeserializeElasticVolumeProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string filePath = default; + long size = default; + ElasticExportPolicy exportPolicy = default; + IList protocolTypes = default; + Models.NetAppProvisioningState? provisioningState = default; + ElasticResourceAvailabilityStatus? availabilityStatus = default; + ResourceIdentifier snapshotResourceId = default; + IReadOnlyList mountTargets = default; + ElasticVolumeDataProtectionProperties dataProtection = default; + SnapshotDirectoryVisibility? snapshotDirectoryVisibility = default; + ElasticSmbProperties smbProperties = default; + ResourceIdentifier backupResourceId = default; + ElasticVolumeRestorationState? restorationState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("filePath"u8)) + { + filePath = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("size"u8)) + { + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("exportPolicy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + exportPolicy = ElasticExportPolicy.DeserializeElasticExportPolicy(prop.Value, options); + continue; + } + if (prop.NameEquals("protocolTypes"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(new ElasticProtocolType(item.GetString())); + } + protocolTypes = array; + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("availabilityStatus"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availabilityStatus = new ElasticResourceAvailabilityStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("snapshotResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("mountTargets"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(ElasticMountTargetProperties.DeserializeElasticMountTargetProperties(item, options)); + } + mountTargets = array; + continue; + } + if (prop.NameEquals("dataProtection"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataProtection = ElasticVolumeDataProtectionProperties.DeserializeElasticVolumeDataProtectionProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("snapshotDirectoryVisibility"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotDirectoryVisibility = new SnapshotDirectoryVisibility(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbProperties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbProperties = ElasticSmbProperties.DeserializeElasticSmbProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("backupResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("restorationState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + restorationState = new ElasticVolumeRestorationState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticVolumeProperties( + filePath, + size, + exportPolicy, + protocolTypes, + provisioningState, + availabilityStatus, + snapshotResourceId, + mountTargets ?? new ChangeTrackingList(), + dataProtection, + snapshotDirectoryVisibility, + smbProperties, + backupResourceId, + restorationState, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVolumeProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticVolumeProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticVolumeProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticVolumeProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVolumeProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeProperties.cs new file mode 100644 index 000000000000..fce554b22a0d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeProperties.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Volume properties. + public partial class ElasticVolumeProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// A unique file path for the volume. Used when creating mount targets. This needs to be unique within the elastic capacity pool. + /// Maximum size allowed for a volume in bytes. Valid values are in the range 1GiB to 16TiB. Values expressed in bytes as multiples of 1 GiB. + /// Set of support protocol types for the elastic volume. + /// or is null. + public ElasticVolumeProperties(string filePath, long size, IEnumerable protocolTypes) + { + Argument.AssertNotNull(filePath, nameof(filePath)); + Argument.AssertNotNull(protocolTypes, nameof(protocolTypes)); + + FilePath = filePath; + Size = size; + ProtocolTypes = protocolTypes.ToList(); + MountTargets = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A unique file path for the volume. Used when creating mount targets. This needs to be unique within the elastic capacity pool. + /// Maximum size allowed for a volume in bytes. Valid values are in the range 1GiB to 16TiB. Values expressed in bytes as multiples of 1 GiB. + /// Set of export policy rules. + /// Set of support protocol types for the elastic volume. + /// Azure lifecycle management. + /// Current availability status of the resource. + /// Resource identifier used to identify the Elastic Snapshot. + /// List of mount targets that can be used to mount this volume. + /// Data protection configuration option for the volume, including snapshot policies and backup. + /// Controls the visibility of the volume's read-only snapshot directory, which provides access to each of the volume's snapshots. + /// SMB Properties. + /// Resource identifier used to identify the Elastic Backup. + /// The current state of the restoration process. + /// Keeps track of any properties unknown to the library. + internal ElasticVolumeProperties(string filePath, long size, ElasticExportPolicy exportPolicy, IList protocolTypes, Models.NetAppProvisioningState? provisioningState, ElasticResourceAvailabilityStatus? availabilityStatus, ResourceIdentifier snapshotResourceId, IReadOnlyList mountTargets, ElasticVolumeDataProtectionProperties dataProtection, SnapshotDirectoryVisibility? snapshotDirectoryVisibility, ElasticSmbProperties smbProperties, ResourceIdentifier backupResourceId, ElasticVolumeRestorationState? restorationState, IDictionary additionalBinaryDataProperties) + { + FilePath = filePath; + Size = size; + ExportPolicy = exportPolicy; + ProtocolTypes = protocolTypes; + ProvisioningState = provisioningState; + AvailabilityStatus = availabilityStatus; + SnapshotResourceId = snapshotResourceId; + MountTargets = mountTargets; + DataProtection = dataProtection; + SnapshotDirectoryVisibility = snapshotDirectoryVisibility; + SmbProperties = smbProperties; + BackupResourceId = backupResourceId; + RestorationState = restorationState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// A unique file path for the volume. Used when creating mount targets. This needs to be unique within the elastic capacity pool. + public string FilePath { get; set; } + + /// Maximum size allowed for a volume in bytes. Valid values are in the range 1GiB to 16TiB. Values expressed in bytes as multiples of 1 GiB. + public long Size { get; set; } + + /// Set of export policy rules. + internal ElasticExportPolicy ExportPolicy { get; set; } + + /// Set of support protocol types for the elastic volume. + public IList ProtocolTypes { get; } + + /// Azure lifecycle management. + public Models.NetAppProvisioningState? ProvisioningState { get; } + + /// Current availability status of the resource. + public ElasticResourceAvailabilityStatus? AvailabilityStatus { get; } + + /// Resource identifier used to identify the Elastic Snapshot. + public ResourceIdentifier SnapshotResourceId { get; set; } + + /// List of mount targets that can be used to mount this volume. + public IReadOnlyList MountTargets { get; } + + /// Data protection configuration option for the volume, including snapshot policies and backup. + public ElasticVolumeDataProtectionProperties DataProtection { get; set; } + + /// Controls the visibility of the volume's read-only snapshot directory, which provides access to each of the volume's snapshots. + public SnapshotDirectoryVisibility? SnapshotDirectoryVisibility { get; set; } + + /// SMB Properties. + internal ElasticSmbProperties SmbProperties { get; set; } + + /// Resource identifier used to identify the Elastic Backup. + public ResourceIdentifier BackupResourceId { get; set; } + + /// The current state of the restoration process. + public ElasticVolumeRestorationState? RestorationState { get; } + + /// Export policy rule. + public IList ExportRules + { + get + { + if (ExportPolicy is null) + { + ExportPolicy = new ElasticExportPolicy(); + } + return ExportPolicy.Rules; + } + } + + /// Used to enable or disable encryption for in-flight SMB data volume. This flag can be modified during Elastic volume update operation as well. Only applicable for SMB protocol Elastic volumes. + public ElasticSmbEncryption? SmbEncryption + { + get + { + return SmbProperties is null ? default : SmbProperties.SmbEncryption; + } + set + { + if (SmbProperties is null) + { + SmbProperties = new ElasticSmbProperties(); + } + SmbProperties.SmbEncryption = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRestorationState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRestorationState.cs new file mode 100644 index 000000000000..b382680f8650 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRestorationState.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The current state of the restoration process. + public readonly partial struct ElasticVolumeRestorationState : IEquatable + { + private readonly string _value; + /// Value indicating that the volume is currently restoring. + private const string RestoringValue = "Restoring"; + /// Value indicating that the volume is restored. + private const string RestoredValue = "Restored"; + /// Value indicating that the volume restore has failed. + private const string FailedValue = "Failed"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ElasticVolumeRestorationState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Value indicating that the volume is currently restoring. + public static ElasticVolumeRestorationState Restoring { get; } = new ElasticVolumeRestorationState(RestoringValue); + + /// Value indicating that the volume is restored. + public static ElasticVolumeRestorationState Restored { get; } = new ElasticVolumeRestorationState(RestoredValue); + + /// Value indicating that the volume restore has failed. + public static ElasticVolumeRestorationState Failed { get; } = new ElasticVolumeRestorationState(FailedValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ElasticVolumeRestorationState left, ElasticVolumeRestorationState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ElasticVolumeRestorationState left, ElasticVolumeRestorationState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticVolumeRestorationState(string value) => new ElasticVolumeRestorationState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ElasticVolumeRestorationState?(string value) => value == null ? null : new ElasticVolumeRestorationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ElasticVolumeRestorationState other && Equals(other); + + /// + public bool Equals(ElasticVolumeRestorationState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRevert.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRevert.Serialization.cs new file mode 100644 index 000000000000..719a6cd4a7e4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRevert.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Reverts the elastic volume to the specified snapshot. + public partial class ElasticVolumeRevert : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeRevert)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotResourceId)) + { + writer.WritePropertyName("snapshotResourceId"u8); + writer.WriteStringValue(SnapshotResourceId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticVolumeRevert IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticVolumeRevert JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeRevert)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVolumeRevert(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticVolumeRevert DeserializeElasticVolumeRevert(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier snapshotResourceId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticVolumeRevert(snapshotResourceId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVolumeRevert)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticVolumeRevert IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticVolumeRevert PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticVolumeRevert(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVolumeRevert)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ElasticVolumeRevert elasticVolumeRevert) + { + if (elasticVolumeRevert == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(elasticVolumeRevert, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRevert.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRevert.cs new file mode 100644 index 000000000000..61aa6b73485a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeRevert.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Reverts the elastic volume to the specified snapshot. + public partial class ElasticVolumeRevert + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticVolumeRevert() + { + } + + /// Initializes a new instance of . + /// Resource identifier used to identify the Elastic Snapshot. + /// Keeps track of any properties unknown to the library. + internal ElasticVolumeRevert(ResourceIdentifier snapshotResourceId, IDictionary additionalBinaryDataProperties) + { + SnapshotResourceId = snapshotResourceId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource identifier used to identify the Elastic Snapshot. + public ResourceIdentifier SnapshotResourceId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeSnapshotProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeSnapshotProperties.Serialization.cs new file mode 100644 index 000000000000..3dbdb548bbf8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeSnapshotProperties.Serialization.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Volume Snapshot Properties. + internal partial class ElasticVolumeSnapshotProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeSnapshotProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotPolicyResourceId)) + { + writer.WritePropertyName("snapshotPolicyResourceId"u8); + writer.WriteStringValue(SnapshotPolicyResourceId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticVolumeSnapshotProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticVolumeSnapshotProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeSnapshotProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVolumeSnapshotProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticVolumeSnapshotProperties DeserializeElasticVolumeSnapshotProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier snapshotPolicyResourceId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotPolicyResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotPolicyResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticVolumeSnapshotProperties(snapshotPolicyResourceId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVolumeSnapshotProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticVolumeSnapshotProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticVolumeSnapshotProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticVolumeSnapshotProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVolumeSnapshotProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeSnapshotProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeSnapshotProperties.cs new file mode 100644 index 000000000000..1f5f35bcb440 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeSnapshotProperties.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Elastic Volume Snapshot Properties. + internal partial class ElasticVolumeSnapshotProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticVolumeSnapshotProperties() + { + } + + /// Initializes a new instance of . + /// Snapshot Policy ResourceId. + /// Keeps track of any properties unknown to the library. + internal ElasticVolumeSnapshotProperties(ResourceIdentifier snapshotPolicyResourceId, IDictionary additionalBinaryDataProperties) + { + SnapshotPolicyResourceId = snapshotPolicyResourceId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Snapshot Policy ResourceId. + public ResourceIdentifier SnapshotPolicyResourceId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeUpdateProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..520b01c5ddbd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeUpdateProperties.Serialization.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The updatable properties of the ElasticVolume. + public partial class ElasticVolumeUpdateProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeUpdateProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(ExportPolicy)) + { + writer.WritePropertyName("exportPolicy"u8); + writer.WriteObjectValue(ExportPolicy, options); + } + if (Optional.IsDefined(DataProtection)) + { + writer.WritePropertyName("dataProtection"u8); + writer.WriteObjectValue(DataProtection, options); + } + if (Optional.IsDefined(SnapshotDirectoryVisibility)) + { + writer.WritePropertyName("snapshotDirectoryVisibility"u8); + writer.WriteStringValue(SnapshotDirectoryVisibility.Value.ToString()); + } + if (Optional.IsDefined(SmbProperties)) + { + writer.WritePropertyName("smbProperties"u8); + writer.WriteObjectValue(SmbProperties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ElasticVolumeUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ElasticVolumeUpdateProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ElasticVolumeUpdateProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeElasticVolumeUpdateProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ElasticVolumeUpdateProperties DeserializeElasticVolumeUpdateProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? size = default; + ElasticExportPolicy exportPolicy = default; + ElasticVolumeDataProtectionPatchProperties dataProtection = default; + SnapshotDirectoryVisibility? snapshotDirectoryVisibility = default; + ElasticSmbPatchProperties smbProperties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("size"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("exportPolicy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + exportPolicy = ElasticExportPolicy.DeserializeElasticExportPolicy(prop.Value, options); + continue; + } + if (prop.NameEquals("dataProtection"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataProtection = ElasticVolumeDataProtectionPatchProperties.DeserializeElasticVolumeDataProtectionPatchProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("snapshotDirectoryVisibility"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotDirectoryVisibility = new SnapshotDirectoryVisibility(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbProperties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbProperties = ElasticSmbPatchProperties.DeserializeElasticSmbPatchProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ElasticVolumeUpdateProperties( + size, + exportPolicy, + dataProtection, + snapshotDirectoryVisibility, + smbProperties, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ElasticVolumeUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ElasticVolumeUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ElasticVolumeUpdateProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeElasticVolumeUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ElasticVolumeUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeUpdateProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeUpdateProperties.cs new file mode 100644 index 000000000000..e19c906714eb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ElasticVolumeUpdateProperties.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The updatable properties of the ElasticVolume. + public partial class ElasticVolumeUpdateProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ElasticVolumeUpdateProperties() + { + } + + /// Initializes a new instance of . + /// Maximum size allowed for a volume in bytes. Valid values are in the range 1GiB to 16TiB. Values expressed in bytes as multiples of 1 GiB. + /// Set of export policy rules. + /// Data protection configuration option for the volume, including snapshot policies and backup. + /// Controls the visibility of the volume's read-only snapshot directory, which provides access to each of the volume's snapshots. + /// SMB Properties. + /// Keeps track of any properties unknown to the library. + internal ElasticVolumeUpdateProperties(long? size, ElasticExportPolicy exportPolicy, ElasticVolumeDataProtectionPatchProperties dataProtection, SnapshotDirectoryVisibility? snapshotDirectoryVisibility, ElasticSmbPatchProperties smbProperties, IDictionary additionalBinaryDataProperties) + { + Size = size; + ExportPolicy = exportPolicy; + DataProtection = dataProtection; + SnapshotDirectoryVisibility = snapshotDirectoryVisibility; + SmbProperties = smbProperties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Maximum size allowed for a volume in bytes. Valid values are in the range 1GiB to 16TiB. Values expressed in bytes as multiples of 1 GiB. + public long? Size { get; set; } + + /// Set of export policy rules. + internal ElasticExportPolicy ExportPolicy { get; set; } + + /// Data protection configuration option for the volume, including snapshot policies and backup. + public ElasticVolumeDataProtectionPatchProperties DataProtection { get; set; } + + /// Controls the visibility of the volume's read-only snapshot directory, which provides access to each of the volume's snapshots. + public SnapshotDirectoryVisibility? SnapshotDirectoryVisibility { get; set; } + + /// SMB Properties. + internal ElasticSmbPatchProperties SmbProperties { get; set; } + + /// Export policy rule. + public IList ExportRules + { + get + { + if (ExportPolicy is null) + { + ExportPolicy = new ElasticExportPolicy(); + } + return ExportPolicy.Rules; + } + } + + /// Used to enable or disable encryption for in-flight SMB data volume. This flag can be modified during Elastic volume update operation as well. Only applicable for SMB protocol Elastic volumes. + public ElasticSmbEncryption? SmbEncryption + { + get + { + return SmbProperties is null ? default : SmbProperties.SmbEncryption; + } + set + { + if (SmbProperties is null) + { + SmbProperties = new ElasticSmbPatchProperties(); + } + SmbProperties.SmbEncryption = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableNetAppSubvolume.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableNetAppSubvolume.cs deleted file mode 100644 index aa217adbb1bc..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableNetAppSubvolume.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Flag indicating whether subvolume operations are enabled on the volume. - public readonly partial struct EnableNetAppSubvolume : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EnableNetAppSubvolume(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// subvolumes are enabled. - public static EnableNetAppSubvolume Enabled { get; } = new EnableNetAppSubvolume(EnabledValue); - /// subvolumes are not enabled. - public static EnableNetAppSubvolume Disabled { get; } = new EnableNetAppSubvolume(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(EnableNetAppSubvolume left, EnableNetAppSubvolume right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EnableNetAppSubvolume left, EnableNetAppSubvolume right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EnableNetAppSubvolume(string value) => new EnableNetAppSubvolume(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EnableNetAppSubvolume other && Equals(other); - /// - public bool Equals(EnableNetAppSubvolume other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableSubvolumes.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableSubvolumes.cs new file mode 100644 index 000000000000..0842959960b3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableSubvolumes.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Flag indicating whether subvolume operations are enabled on the volume. + public readonly partial struct EnableSubvolumes : IEquatable + { + private readonly string _value; + /// subvolumes are enabled. + private const string EnabledValue = "Enabled"; + /// subvolumes are not enabled. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public EnableSubvolumes(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// subvolumes are enabled. + public static EnableSubvolumes Enabled { get; } = new EnableSubvolumes(EnabledValue); + + /// subvolumes are not enabled. + public static EnableSubvolumes Disabled { get; } = new EnableSubvolumes(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(EnableSubvolumes left, EnableSubvolumes right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(EnableSubvolumes left, EnableSubvolumes right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator EnableSubvolumes(string value) => new EnableSubvolumes(value); + + /// Converts a string to a . + /// The value. + public static implicit operator EnableSubvolumes?(string value) => value == null ? null : new EnableSubvolumes(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EnableSubvolumes other && Equals(other); + + /// + public bool Equals(EnableSubvolumes other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableWriteBackState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableWriteBackState.cs new file mode 100644 index 000000000000..0c12499024a3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EnableWriteBackState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Flag indicating whether writeback is enabled for the cache. + public readonly partial struct EnableWriteBackState : IEquatable + { + private readonly string _value; + /// Writeback cache is disabled. + private const string DisabledValue = "Disabled"; + /// Writeback cache is enabled. + private const string EnabledValue = "Enabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public EnableWriteBackState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Writeback cache is disabled. + public static EnableWriteBackState Disabled { get; } = new EnableWriteBackState(DisabledValue); + + /// Writeback cache is enabled. + public static EnableWriteBackState Enabled { get; } = new EnableWriteBackState(EnabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(EnableWriteBackState left, EnableWriteBackState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(EnableWriteBackState left, EnableWriteBackState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator EnableWriteBackState(string value) => new EnableWriteBackState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator EnableWriteBackState?(string value) => value == null ? null : new EnableWriteBackState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EnableWriteBackState other && Equals(other); + + /// + public bool Equals(EnableWriteBackState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionIdentity.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionIdentity.Serialization.cs new file mode 100644 index 000000000000..5fabb9132ee1 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionIdentity.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Identity used to authenticate with key vault. + public partial class EncryptionIdentity : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EncryptionIdentity)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId); + } + if (Optional.IsDefined(UserAssignedIdentity)) + { + writer.WritePropertyName("userAssignedIdentity"u8); + writer.WriteStringValue(UserAssignedIdentity); + } + if (Optional.IsDefined(FederatedClientId)) + { + writer.WritePropertyName("federatedClientId"u8); + writer.WriteStringValue(FederatedClientId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + EncryptionIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual EncryptionIdentity JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EncryptionIdentity)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEncryptionIdentity(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static EncryptionIdentity DeserializeEncryptionIdentity(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string principalId = default; + string userAssignedIdentity = default; + string federatedClientId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("principalId"u8)) + { + principalId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("userAssignedIdentity"u8)) + { + userAssignedIdentity = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("federatedClientId"u8)) + { + federatedClientId = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new EncryptionIdentity(principalId, userAssignedIdentity, federatedClientId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(EncryptionIdentity)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + EncryptionIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual EncryptionIdentity PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeEncryptionIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EncryptionIdentity)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionIdentity.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionIdentity.cs new file mode 100644 index 000000000000..91ca10c3b267 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionIdentity.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Identity used to authenticate with key vault. + public partial class EncryptionIdentity + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public EncryptionIdentity() + { + } + + /// Initializes a new instance of . + /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. + /// The ARM resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. + /// ClientId of the multi-tenant AAD Application. Used to access cross-tenant keyvaults. + /// Keeps track of any properties unknown to the library. + internal EncryptionIdentity(string principalId, string userAssignedIdentity, string federatedClientId, IDictionary additionalBinaryDataProperties) + { + PrincipalId = principalId; + UserAssignedIdentity = userAssignedIdentity; + FederatedClientId = federatedClientId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. + public string PrincipalId { get; } + + /// The ARM resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. + public string UserAssignedIdentity { get; set; } + + /// ClientId of the multi-tenant AAD Application. Used to access cross-tenant keyvaults. + public string FederatedClientId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionKeySource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionKeySource.cs new file mode 100644 index 000000000000..f9c4f7574d3b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionKeySource.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. + public readonly partial struct EncryptionKeySource : IEquatable + { + private readonly string _value; + /// Microsoft-managed key encryption. + private const string MicrosoftNetAppValue = "Microsoft.NetApp"; + /// Customer-managed key encryption. + private const string MicrosoftKeyVaultValue = "Microsoft.KeyVault"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public EncryptionKeySource(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Microsoft-managed key encryption. + public static EncryptionKeySource MicrosoftNetApp { get; } = new EncryptionKeySource(MicrosoftNetAppValue); + + /// Customer-managed key encryption. + public static EncryptionKeySource MicrosoftKeyVault { get; } = new EncryptionKeySource(MicrosoftKeyVaultValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(EncryptionKeySource left, EncryptionKeySource right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(EncryptionKeySource left, EncryptionKeySource right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator EncryptionKeySource(string value) => new EncryptionKeySource(value); + + /// Converts a string to a . + /// The value. + public static implicit operator EncryptionKeySource?(string value) => value == null ? null : new EncryptionKeySource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EncryptionKeySource other && Equals(other); + + /// + public bool Equals(EncryptionKeySource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionState.cs new file mode 100644 index 000000000000..e6be0105d4bb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Specifies if the cache is encryption or not. + public readonly partial struct EncryptionState : IEquatable + { + private readonly string _value; + /// Encryption is disabled. + private const string DisabledValue = "Disabled"; + /// Encryption is enabled. + private const string EnabledValue = "Enabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public EncryptionState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Encryption is disabled. + public static EncryptionState Disabled { get; } = new EncryptionState(DisabledValue); + + /// Encryption is enabled. + public static EncryptionState Enabled { get; } = new EncryptionState(EnabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(EncryptionState left, EncryptionState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(EncryptionState left, EncryptionState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator EncryptionState(string value) => new EncryptionState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator EncryptionState?(string value) => value == null ? null : new EncryptionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EncryptionState other && Equals(other); + + /// + public bool Equals(EncryptionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionTransitionRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionTransitionRequest.Serialization.cs new file mode 100644 index 000000000000..127a452e00e8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionTransitionRequest.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Encryption transition request. + public partial class EncryptionTransitionRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal EncryptionTransitionRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EncryptionTransitionRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("virtualNetworkId"u8); + writer.WriteStringValue(VirtualNetworkId); + writer.WritePropertyName("privateEndpointId"u8); + writer.WriteStringValue(PrivateEndpointId); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + EncryptionTransitionRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual EncryptionTransitionRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EncryptionTransitionRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEncryptionTransitionRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static EncryptionTransitionRequest DeserializeEncryptionTransitionRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier virtualNetworkId = default; + ResourceIdentifier privateEndpointId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("virtualNetworkId"u8)) + { + virtualNetworkId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("privateEndpointId"u8)) + { + privateEndpointId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new EncryptionTransitionRequest(virtualNetworkId, privateEndpointId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(EncryptionTransitionRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + EncryptionTransitionRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual EncryptionTransitionRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeEncryptionTransitionRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EncryptionTransitionRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(EncryptionTransitionRequest encryptionTransitionRequest) + { + if (encryptionTransitionRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(encryptionTransitionRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionTransitionRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionTransitionRequest.cs new file mode 100644 index 000000000000..541c5123fbc8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/EncryptionTransitionRequest.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Encryption transition request. + public partial class EncryptionTransitionRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Identifier for the virtual network. + /// Identifier of the private endpoint to reach the Azure Key Vault. + /// or is null. + public EncryptionTransitionRequest(ResourceIdentifier virtualNetworkId, ResourceIdentifier privateEndpointId) + { + Argument.AssertNotNull(virtualNetworkId, nameof(virtualNetworkId)); + Argument.AssertNotNull(privateEndpointId, nameof(privateEndpointId)); + + VirtualNetworkId = virtualNetworkId; + PrivateEndpointId = privateEndpointId; + } + + /// Initializes a new instance of . + /// Identifier for the virtual network. + /// Identifier of the private endpoint to reach the Azure Key Vault. + /// Keeps track of any properties unknown to the library. + internal EncryptionTransitionRequest(ResourceIdentifier virtualNetworkId, ResourceIdentifier privateEndpointId, IDictionary additionalBinaryDataProperties) + { + VirtualNetworkId = virtualNetworkId; + PrivateEndpointId = privateEndpointId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Identifier for the virtual network. + public ResourceIdentifier VirtualNetworkId { get; } + + /// Identifier of the private endpoint to reach the Azure Key Vault. + public ResourceIdentifier PrivateEndpointId { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Exclude.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Exclude.cs new file mode 100644 index 000000000000..c084faf8d5a3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Exclude.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// An option to filter out replications. 'None' returns all replications, 'Deleted' excludes deleted replications. Default is 'None'. + public readonly partial struct Exclude : IEquatable + { + private readonly string _value; + /// 'None' returns all replications. + private const string NoneValue = "None"; + /// 'Deleted' excludes deleted replications. + private const string DeletedValue = "Deleted"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public Exclude(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// 'None' returns all replications. + public static Exclude None { get; } = new Exclude(NoneValue); + + /// 'Deleted' excludes deleted replications. + public static Exclude Deleted { get; } = new Exclude(DeletedValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(Exclude left, Exclude right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(Exclude left, Exclude right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator Exclude(string value) => new Exclude(value); + + /// Converts a string to a . + /// The value. + public static implicit operator Exclude?(string value) => value == null ? null : new Exclude(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Exclude other && Equals(other); + + /// + public bool Equals(Exclude other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExportPolicyRule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExportPolicyRule.Serialization.cs new file mode 100644 index 000000000000..b9d0dcbd2d88 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExportPolicyRule.Serialization.cs @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume Export Policy Rule. + public partial class ExportPolicyRule : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExportPolicyRule)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(RuleIndex)) + { + writer.WritePropertyName("ruleIndex"u8); + writer.WriteNumberValue(RuleIndex.Value); + } + if (Optional.IsDefined(UnixReadOnly)) + { + writer.WritePropertyName("unixReadOnly"u8); + writer.WriteBooleanValue(UnixReadOnly.Value); + } + if (Optional.IsDefined(UnixReadWrite)) + { + writer.WritePropertyName("unixReadWrite"u8); + writer.WriteBooleanValue(UnixReadWrite.Value); + } + if (Optional.IsDefined(Kerberos5ReadOnly)) + { + writer.WritePropertyName("kerberos5ReadOnly"u8); + writer.WriteBooleanValue(Kerberos5ReadOnly.Value); + } + if (Optional.IsDefined(Kerberos5ReadWrite)) + { + writer.WritePropertyName("kerberos5ReadWrite"u8); + writer.WriteBooleanValue(Kerberos5ReadWrite.Value); + } + if (Optional.IsDefined(Kerberos5IReadOnly)) + { + writer.WritePropertyName("kerberos5iReadOnly"u8); + writer.WriteBooleanValue(Kerberos5IReadOnly.Value); + } + if (Optional.IsDefined(Kerberos5IReadWrite)) + { + writer.WritePropertyName("kerberos5iReadWrite"u8); + writer.WriteBooleanValue(Kerberos5IReadWrite.Value); + } + if (Optional.IsDefined(Kerberos5PReadOnly)) + { + writer.WritePropertyName("kerberos5pReadOnly"u8); + writer.WriteBooleanValue(Kerberos5PReadOnly.Value); + } + if (Optional.IsDefined(Kerberos5PReadWrite)) + { + writer.WritePropertyName("kerberos5pReadWrite"u8); + writer.WriteBooleanValue(Kerberos5PReadWrite.Value); + } + if (Optional.IsDefined(Cifs)) + { + writer.WritePropertyName("cifs"u8); + writer.WriteBooleanValue(Cifs.Value); + } + if (Optional.IsDefined(Nfsv3)) + { + writer.WritePropertyName("nfsv3"u8); + writer.WriteBooleanValue(Nfsv3.Value); + } + if (Optional.IsDefined(Nfsv41)) + { + writer.WritePropertyName("nfsv41"u8); + writer.WriteBooleanValue(Nfsv41.Value); + } + if (Optional.IsDefined(AllowedClients)) + { + writer.WritePropertyName("allowedClients"u8); + writer.WriteStringValue(AllowedClients); + } + if (Optional.IsDefined(HasRootAccess)) + { + writer.WritePropertyName("hasRootAccess"u8); + writer.WriteBooleanValue(HasRootAccess.Value); + } + if (Optional.IsDefined(ChownMode)) + { + writer.WritePropertyName("chownMode"u8); + writer.WriteStringValue(ChownMode.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ExportPolicyRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ExportPolicyRule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExportPolicyRule)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExportPolicyRule(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ExportPolicyRule DeserializeExportPolicyRule(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? ruleIndex = default; + bool? unixReadOnly = default; + bool? unixReadWrite = default; + bool? kerberos5ReadOnly = default; + bool? kerberos5ReadWrite = default; + bool? kerberos5IReadOnly = default; + bool? kerberos5IReadWrite = default; + bool? kerberos5PReadOnly = default; + bool? kerberos5PReadWrite = default; + bool? cifs = default; + bool? nfsv3 = default; + bool? nfsv41 = default; + string allowedClients = default; + bool? hasRootAccess = default; + ChownMode? chownMode = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("ruleIndex"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ruleIndex = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("unixReadOnly"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + unixReadOnly = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("unixReadWrite"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + unixReadWrite = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("kerberos5ReadOnly"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kerberos5ReadOnly = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("kerberos5ReadWrite"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kerberos5ReadWrite = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("kerberos5iReadOnly"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kerberos5IReadOnly = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("kerberos5iReadWrite"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kerberos5IReadWrite = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("kerberos5pReadOnly"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kerberos5PReadOnly = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("kerberos5pReadWrite"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kerberos5PReadWrite = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("cifs"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cifs = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("nfsv3"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfsv3 = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("nfsv41"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfsv41 = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("allowedClients"u8)) + { + allowedClients = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("hasRootAccess"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hasRootAccess = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("chownMode"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + chownMode = new ChownMode(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ExportPolicyRule( + ruleIndex, + unixReadOnly, + unixReadWrite, + kerberos5ReadOnly, + kerberos5ReadWrite, + kerberos5IReadOnly, + kerberos5IReadWrite, + kerberos5PReadOnly, + kerberos5PReadWrite, + cifs, + nfsv3, + nfsv41, + allowedClients, + hasRootAccess, + chownMode, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ExportPolicyRule)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ExportPolicyRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ExportPolicyRule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeExportPolicyRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExportPolicyRule)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExportPolicyRule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExportPolicyRule.cs new file mode 100644 index 000000000000..a0120feb9333 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExportPolicyRule.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume Export Policy Rule. + public partial class ExportPolicyRule + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ExportPolicyRule() + { + } + + /// Initializes a new instance of . + /// Order index. + /// Read only access. + /// Read and write access. + /// Kerberos5 Read only access. To be use with swagger version 2020-05-01 or later. + /// Kerberos5 Read and write access. To be use with swagger version 2020-05-01 or later. + /// Kerberos5i Read only access. To be use with swagger version 2020-05-01 or later. + /// Kerberos5i Read and write access. To be use with swagger version 2020-05-01 or later. + /// Kerberos5p Read only access. To be use with swagger version 2020-05-01 or later. + /// Kerberos5p Read and write access. To be use with swagger version 2020-05-01 or later. + /// Allows CIFS protocol. + /// Allows NFSv3 protocol. Enable only for NFSv3 type volumes. + /// Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes. + /// Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names. + /// Has root access to volume. + /// This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root users can change ownership of files that they own. + /// Keeps track of any properties unknown to the library. + internal ExportPolicyRule(int? ruleIndex, bool? unixReadOnly, bool? unixReadWrite, bool? kerberos5ReadOnly, bool? kerberos5ReadWrite, bool? kerberos5IReadOnly, bool? kerberos5IReadWrite, bool? kerberos5PReadOnly, bool? kerberos5PReadWrite, bool? cifs, bool? nfsv3, bool? nfsv41, string allowedClients, bool? hasRootAccess, ChownMode? chownMode, IDictionary additionalBinaryDataProperties) + { + RuleIndex = ruleIndex; + UnixReadOnly = unixReadOnly; + UnixReadWrite = unixReadWrite; + Kerberos5ReadOnly = kerberos5ReadOnly; + Kerberos5ReadWrite = kerberos5ReadWrite; + Kerberos5IReadOnly = kerberos5IReadOnly; + Kerberos5IReadWrite = kerberos5IReadWrite; + Kerberos5PReadOnly = kerberos5PReadOnly; + Kerberos5PReadWrite = kerberos5PReadWrite; + Cifs = cifs; + Nfsv3 = nfsv3; + Nfsv41 = nfsv41; + AllowedClients = allowedClients; + HasRootAccess = hasRootAccess; + ChownMode = chownMode; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Order index. + public int? RuleIndex { get; set; } + + /// Read only access. + public bool? UnixReadOnly { get; set; } + + /// Read and write access. + public bool? UnixReadWrite { get; set; } + + /// Kerberos5 Read only access. To be use with swagger version 2020-05-01 or later. + public bool? Kerberos5ReadOnly { get; set; } + + /// Kerberos5 Read and write access. To be use with swagger version 2020-05-01 or later. + public bool? Kerberos5ReadWrite { get; set; } + + /// Kerberos5i Read only access. To be use with swagger version 2020-05-01 or later. + public bool? Kerberos5IReadOnly { get; set; } + + /// Kerberos5i Read and write access. To be use with swagger version 2020-05-01 or later. + public bool? Kerberos5IReadWrite { get; set; } + + /// Kerberos5p Read only access. To be use with swagger version 2020-05-01 or later. + public bool? Kerberos5PReadOnly { get; set; } + + /// Kerberos5p Read and write access. To be use with swagger version 2020-05-01 or later. + public bool? Kerberos5PReadWrite { get; set; } + + /// Allows CIFS protocol. + public bool? Cifs { get; set; } + + /// Allows NFSv3 protocol. Enable only for NFSv3 type volumes. + public bool? Nfsv3 { get; set; } + + /// Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes. + public bool? Nfsv41 { get; set; } + + /// Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names. + public string AllowedClients { get; set; } + + /// Has root access to volume. + public bool? HasRootAccess { get; set; } + + /// This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root users can change ownership of files that they own. + public ChownMode? ChownMode { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExternalReplicationSetupStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExternalReplicationSetupStatus.cs index 7884f10fface..f0439f1de02a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExternalReplicationSetupStatus.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ExternalReplicationSetupStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,47 +15,72 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct ExternalReplicationSetupStatus : IEquatable { private readonly string _value; + /// Your cluster needs to be peered by using the 'peerExternalCluster' action. + private const string ClusterPeerRequiredValue = "ClusterPeerRequired"; + /// The peering needs to be accepted on your cluster before the setup can proceed. + private const string ClusterPeerPendingValue = "ClusterPeerPending"; + /// Need to call 'authorizeExternalReplication' and accept the returned 'vserver peer accept' command on your cluster to finish setting up the external replication. + private const string VServerPeerRequiredValue = "VServerPeerRequired"; + /// Need to call 'authorizeExternalReplication' to finish setting up the external replication. + private const string ReplicationCreateRequiredValue = "ReplicationCreateRequired"; + /// External Replication setup is complete, you can now monitor the 'mirrorState' in the replication status for the health of the replication. + private const string NoActionRequiredValue = "NoActionRequired"; /// Initializes a new instance of . + /// The value. /// is null. public ExternalReplicationSetupStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string ClusterPeerRequiredValue = "ClusterPeerRequired"; - private const string ClusterPeerPendingValue = "ClusterPeerPending"; - private const string VServerPeerRequiredValue = "VServerPeerRequired"; - private const string ReplicationCreateRequiredValue = "ReplicationCreateRequired"; - private const string NoActionRequiredValue = "NoActionRequired"; + _value = value; + } /// Your cluster needs to be peered by using the 'peerExternalCluster' action. public static ExternalReplicationSetupStatus ClusterPeerRequired { get; } = new ExternalReplicationSetupStatus(ClusterPeerRequiredValue); + /// The peering needs to be accepted on your cluster before the setup can proceed. public static ExternalReplicationSetupStatus ClusterPeerPending { get; } = new ExternalReplicationSetupStatus(ClusterPeerPendingValue); + /// Need to call 'authorizeExternalReplication' and accept the returned 'vserver peer accept' command on your cluster to finish setting up the external replication. public static ExternalReplicationSetupStatus VServerPeerRequired { get; } = new ExternalReplicationSetupStatus(VServerPeerRequiredValue); + /// Need to call 'authorizeExternalReplication' to finish setting up the external replication. public static ExternalReplicationSetupStatus ReplicationCreateRequired { get; } = new ExternalReplicationSetupStatus(ReplicationCreateRequiredValue); + /// External Replication setup is complete, you can now monitor the 'mirrorState' in the replication status for the health of the replication. public static ExternalReplicationSetupStatus NoActionRequired { get; } = new ExternalReplicationSetupStatus(NoActionRequiredValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ExternalReplicationSetupStatus left, ExternalReplicationSetupStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ExternalReplicationSetupStatus left, ExternalReplicationSetupStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ExternalReplicationSetupStatus(string value) => new ExternalReplicationSetupStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ExternalReplicationSetupStatus?(string value) => value == null ? null : new ExternalReplicationSetupStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ExternalReplicationSetupStatus other && Equals(other); - /// + + /// public bool Equals(ExternalReplicationSetupStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileAccessLogs.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileAccessLogs.cs new file mode 100644 index 000000000000..d0a9dcd6c0c6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileAccessLogs.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. + public readonly partial struct FileAccessLogs : IEquatable + { + private readonly string _value; + /// fileAccessLogs are enabled. + private const string EnabledValue = "Enabled"; + /// fileAccessLogs are not enabled. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public FileAccessLogs(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// fileAccessLogs are enabled. + public static FileAccessLogs Enabled { get; } = new FileAccessLogs(EnabledValue); + + /// fileAccessLogs are not enabled. + public static FileAccessLogs Disabled { get; } = new FileAccessLogs(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(FileAccessLogs left, FileAccessLogs right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(FileAccessLogs left, FileAccessLogs right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator FileAccessLogs(string value) => new FileAccessLogs(value); + + /// Converts a string to a . + /// The value. + public static implicit operator FileAccessLogs?(string value) => value == null ? null : new FileAccessLogs(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FileAccessLogs other && Equals(other); + + /// + public bool Equals(FileAccessLogs other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FilePathAvailabilityRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FilePathAvailabilityRequest.Serialization.cs new file mode 100644 index 000000000000..8224c416114b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FilePathAvailabilityRequest.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// File path availability request content - availability is based on the name and the subnetId. + public partial class FilePathAvailabilityRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal FilePathAvailabilityRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FilePathAvailabilityRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + if (Optional.IsDefined(AvailabilityZone)) + { + writer.WritePropertyName("availabilityZone"u8); + writer.WriteStringValue(AvailabilityZone); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + FilePathAvailabilityRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual FilePathAvailabilityRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FilePathAvailabilityRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFilePathAvailabilityRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static FilePathAvailabilityRequest DeserializeFilePathAvailabilityRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string subnetId = default; + string availabilityZone = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("subnetId"u8)) + { + subnetId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("availabilityZone"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + availabilityZone = null; + continue; + } + availabilityZone = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new FilePathAvailabilityRequest(name, subnetId, availabilityZone, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(FilePathAvailabilityRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + FilePathAvailabilityRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual FilePathAvailabilityRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeFilePathAvailabilityRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FilePathAvailabilityRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(FilePathAvailabilityRequest filePathAvailabilityRequest) + { + if (filePathAvailabilityRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(filePathAvailabilityRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FilePathAvailabilityRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FilePathAvailabilityRequest.cs new file mode 100644 index 000000000000..c3e373f3c28f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FilePathAvailabilityRequest.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// File path availability request content - availability is based on the name and the subnetId. + public partial class FilePathAvailabilityRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// File path to verify. + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. + /// or is null. + public FilePathAvailabilityRequest(string name, string subnetId) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(subnetId, nameof(subnetId)); + + Name = name; + SubnetId = subnetId; + } + + /// Initializes a new instance of . + /// File path to verify. + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. + /// The Azure Resource logical availability zone which is used within zone mapping lookup for the subscription and region. The lookup will retrieve the physical zone where volume is placed. + /// Keeps track of any properties unknown to the library. + internal FilePathAvailabilityRequest(string name, string subnetId, string availabilityZone, IDictionary additionalBinaryDataProperties) + { + Name = name; + SubnetId = subnetId; + AvailabilityZone = availabilityZone; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// File path to verify. + public string Name { get; } + + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. + public string SubnetId { get; } + + /// The Azure Resource logical availability zone which is used within zone mapping lookup for the subscription and region. The lookup will retrieve the physical zone where volume is placed. + public string AvailabilityZone { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileSystemUser.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileSystemUser.Serialization.cs new file mode 100644 index 000000000000..f67d18ae0402 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileSystemUser.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. + public partial class FileSystemUser : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSystemUser)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(NfsUser)) + { + writer.WritePropertyName("nfsUser"u8); + writer.WriteObjectValue(NfsUser, options); + } + if (Optional.IsDefined(CifsUser)) + { + writer.WritePropertyName("cifsUser"u8); + writer.WriteObjectValue(CifsUser, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + FileSystemUser IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual FileSystemUser JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FileSystemUser)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFileSystemUser(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static FileSystemUser DeserializeFileSystemUser(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NfsUser nfsUser = default; + CifsUser cifsUser = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("nfsUser"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nfsUser = NfsUser.DeserializeNfsUser(prop.Value, options); + continue; + } + if (prop.NameEquals("cifsUser"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cifsUser = CifsUser.DeserializeCifsUser(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new FileSystemUser(nfsUser, cifsUser, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(FileSystemUser)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + FileSystemUser IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual FileSystemUser PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeFileSystemUser(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FileSystemUser)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileSystemUser.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileSystemUser.cs new file mode 100644 index 000000000000..db46ddb9a971 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/FileSystemUser.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. + public partial class FileSystemUser + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public FileSystemUser() + { + } + + /// Initializes a new instance of . + /// The effective NFS User ID and Group ID when accessing the volume data. + /// The effective CIFS username when accessing the volume data. + /// Keeps track of any properties unknown to the library. + internal FileSystemUser(NfsUser nfsUser, CifsUser cifsUser, IDictionary additionalBinaryDataProperties) + { + NfsUser = nfsUser; + CifsUser = cifsUser; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The effective NFS User ID and Group ID when accessing the volume data. + public NfsUser NfsUser { get; set; } + + /// The effective CIFS username when accessing the volume data. + internal CifsUser CifsUser { get; set; } + + /// The CIFS user's username. + public string CifsUserUsername + { + get + { + return CifsUser is null ? default : CifsUser.Username; + } + set + { + if (CifsUser is null) + { + CifsUser = new CifsUser(); + } + CifsUser.Username = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserContent.Serialization.cs deleted file mode 100644 index a600259dc508..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserContent.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class GetGroupIdListForLdapUserContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("username"u8); - writer.WriteStringValue(Username); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - GetGroupIdListForLdapUserContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeGetGroupIdListForLdapUserContent(document.RootElement, options); - } - - internal static GetGroupIdListForLdapUserContent DeserializeGetGroupIdListForLdapUserContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string username = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("username"u8)) - { - username = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new GetGroupIdListForLdapUserContent(username, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserContent)} does not support writing '{options.Format}' format."); - } - } - - GetGroupIdListForLdapUserContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeGetGroupIdListForLdapUserContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserContent.cs deleted file mode 100644 index 92a91c974fff..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserContent.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Get group Id list for LDAP User request. - public partial class GetGroupIdListForLdapUserContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// username is required to fetch the group to which user is part of. - /// is null. - public GetGroupIdListForLdapUserContent(string username) - { - Argument.AssertNotNull(username, nameof(username)); - - Username = username; - } - - /// Initializes a new instance of . - /// username is required to fetch the group to which user is part of. - /// Keeps track of any properties unknown to the library. - internal GetGroupIdListForLdapUserContent(string username, IDictionary serializedAdditionalRawData) - { - Username = username; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal GetGroupIdListForLdapUserContent() - { - } - - /// username is required to fetch the group to which user is part of. - public string Username { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserRequest.Serialization.cs new file mode 100644 index 000000000000..794a3c869c74 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserRequest.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Get group Id list for LDAP User request. + public partial class GetGroupIdListForLdapUserRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal GetGroupIdListForLdapUserRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("username"u8); + writer.WriteStringValue(Username); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + GetGroupIdListForLdapUserRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual GetGroupIdListForLdapUserRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGetGroupIdListForLdapUserRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static GetGroupIdListForLdapUserRequest DeserializeGetGroupIdListForLdapUserRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string username = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("username"u8)) + { + username = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new GetGroupIdListForLdapUserRequest(username, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + GetGroupIdListForLdapUserRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual GetGroupIdListForLdapUserRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeGetGroupIdListForLdapUserRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(GetGroupIdListForLdapUserRequest getGroupIdListForLdapUserRequest) + { + if (getGroupIdListForLdapUserRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(getGroupIdListForLdapUserRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserRequest.cs new file mode 100644 index 000000000000..cc3569efcf6d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserRequest.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Get group Id list for LDAP User request. + public partial class GetGroupIdListForLdapUserRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// username is required to fetch the group to which user is part of. + /// is null. + public GetGroupIdListForLdapUserRequest(string username) + { + Argument.AssertNotNull(username, nameof(username)); + + Username = username; + } + + /// Initializes a new instance of . + /// username is required to fetch the group to which user is part of. + /// Keeps track of any properties unknown to the library. + internal GetGroupIdListForLdapUserRequest(string username, IDictionary additionalBinaryDataProperties) + { + Username = username; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// username is required to fetch the group to which user is part of. + public string Username { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResponse.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResponse.Serialization.cs new file mode 100644 index 000000000000..6acd9858df39 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResponse.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Group Id list for Ldap user. + public partial class GetGroupIdListForLdapUserResponse : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserResponse)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(GroupIdsForLdapUser)) + { + writer.WritePropertyName("groupIdsForLdapUser"u8); + writer.WriteStartArray(); + foreach (string item in GroupIdsForLdapUser) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + GetGroupIdListForLdapUserResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual GetGroupIdListForLdapUserResponse JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserResponse)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGetGroupIdListForLdapUserResponse(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static GetGroupIdListForLdapUserResponse DeserializeGetGroupIdListForLdapUserResponse(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList groupIdsForLdapUser = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("groupIdsForLdapUser"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + groupIdsForLdapUser = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new GetGroupIdListForLdapUserResponse(groupIdsForLdapUser ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserResponse)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + GetGroupIdListForLdapUserResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual GetGroupIdListForLdapUserResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeGetGroupIdListForLdapUserResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static GetGroupIdListForLdapUserResponse FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeGetGroupIdListForLdapUserResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResponse.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResponse.cs new file mode 100644 index 000000000000..f52e7e06eb57 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResponse.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Group Id list for Ldap user. + public partial class GetGroupIdListForLdapUserResponse + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal GetGroupIdListForLdapUserResponse() + { + GroupIdsForLdapUser = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Group Id list. + /// Keeps track of any properties unknown to the library. + internal GetGroupIdListForLdapUserResponse(IList groupIdsForLdapUser, IDictionary additionalBinaryDataProperties) + { + GroupIdsForLdapUser = groupIdsForLdapUser; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Group Id list. + public IList GroupIdsForLdapUser { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResult.Serialization.cs deleted file mode 100644 index 073434a5dff2..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResult.Serialization.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class GetGroupIdListForLdapUserResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserResult)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(GroupIdsForLdapUser)) - { - writer.WritePropertyName("groupIdsForLdapUser"u8); - writer.WriteStartArray(); - foreach (var item in GroupIdsForLdapUser) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - GetGroupIdListForLdapUserResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeGetGroupIdListForLdapUserResult(document.RootElement, options); - } - - internal static GetGroupIdListForLdapUserResult DeserializeGetGroupIdListForLdapUserResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList groupIdsForLdapUser = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("groupIdsForLdapUser"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - groupIdsForLdapUser = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new GetGroupIdListForLdapUserResult(groupIdsForLdapUser ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserResult)} does not support writing '{options.Format}' format."); - } - } - - GetGroupIdListForLdapUserResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeGetGroupIdListForLdapUserResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(GetGroupIdListForLdapUserResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResult.cs deleted file mode 100644 index 294a9686c801..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetGroupIdListForLdapUserResult.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Group Id list for Ldap user. - public partial class GetGroupIdListForLdapUserResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal GetGroupIdListForLdapUserResult() - { - GroupIdsForLdapUser = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Group Id list. - /// Keeps track of any properties unknown to the library. - internal GetGroupIdListForLdapUserResult(IReadOnlyList groupIdsForLdapUser, IDictionary serializedAdditionalRawData) - { - GroupIdsForLdapUser = groupIdsForLdapUser; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Group Id list. - public IReadOnlyList GroupIdsForLdapUser { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponse.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponse.Serialization.cs new file mode 100644 index 000000000000..5b3cff7d1df6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponse.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Result of getKeyVaultStatus with information about how volumes under NetApp account are encrypted. + public partial class GetKeyVaultStatusResponse : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetKeyVaultStatusResponse)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + GetKeyVaultStatusResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual GetKeyVaultStatusResponse JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetKeyVaultStatusResponse)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGetKeyVaultStatusResponse(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static GetKeyVaultStatusResponse DeserializeGetKeyVaultStatusResponse(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GetKeyVaultStatusResponseProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = GetKeyVaultStatusResponseProperties.DeserializeGetKeyVaultStatusResponseProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new GetKeyVaultStatusResponse(properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(GetKeyVaultStatusResponse)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + GetKeyVaultStatusResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual GetKeyVaultStatusResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeGetKeyVaultStatusResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GetKeyVaultStatusResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static GetKeyVaultStatusResponse FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeGetKeyVaultStatusResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponse.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponse.cs new file mode 100644 index 000000000000..d0d9aac61ab6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponse.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Result of getKeyVaultStatus with information about how volumes under NetApp account are encrypted. + public partial class GetKeyVaultStatusResponse + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal GetKeyVaultStatusResponse() + { + } + + /// Initializes a new instance of . + /// Represents the properties of the getKeyVaultStatus. + /// Keeps track of any properties unknown to the library. + internal GetKeyVaultStatusResponse(GetKeyVaultStatusResponseProperties properties, IDictionary additionalBinaryDataProperties) + { + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Represents the properties of the getKeyVaultStatus. + internal GetKeyVaultStatusResponseProperties Properties { get; } + + /// The URI of the key vault/managed HSM that should be used for encryption. + public Uri KeyVaultUri + { + get + { + return Properties.KeyVaultUri; + } + } + + /// The name of the key that should be used for encryption. + public string KeyName + { + get + { + return Properties.KeyName; + } + } + + /// Azure resource ID of the key vault/managed HSM that should be used for encryption. + public ResourceIdentifier KeyVaultResourceId + { + get + { + return Properties.KeyVaultResourceId; + } + } + + /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. + public IList KeyVaultPrivateEndpoints + { + get + { + return Properties.KeyVaultPrivateEndpoints; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponseProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponseProperties.Serialization.cs new file mode 100644 index 000000000000..9a7e5ac84ffd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponseProperties.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties which represents Change key vault status. + internal partial class GetKeyVaultStatusResponseProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetKeyVaultStatusResponseProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(KeyVaultUri)) + { + writer.WritePropertyName("keyVaultUri"u8); + writer.WriteStringValue(KeyVaultUri.AbsoluteUri); + } + if (Optional.IsDefined(KeyName)) + { + writer.WritePropertyName("keyName"u8); + writer.WriteStringValue(KeyName); + } + if (Optional.IsDefined(KeyVaultResourceId)) + { + writer.WritePropertyName("keyVaultResourceId"u8); + writer.WriteStringValue(KeyVaultResourceId); + } + if (Optional.IsCollectionDefined(KeyVaultPrivateEndpoints)) + { + writer.WritePropertyName("keyVaultPrivateEndpoints"u8); + writer.WriteStartArray(); + foreach (KeyVaultPrivateEndpoint item in KeyVaultPrivateEndpoints) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + GetKeyVaultStatusResponseProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual GetKeyVaultStatusResponseProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetKeyVaultStatusResponseProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGetKeyVaultStatusResponseProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static GetKeyVaultStatusResponseProperties DeserializeGetKeyVaultStatusResponseProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri keyVaultUri = default; + string keyName = default; + ResourceIdentifier keyVaultResourceId = default; + IList keyVaultPrivateEndpoints = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("keyVaultUri"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultUri = new Uri(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyName"u8)) + { + keyName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("keyVaultResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyVaultPrivateEndpoints"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(KeyVaultPrivateEndpoint.DeserializeKeyVaultPrivateEndpoint(item, options)); + } + keyVaultPrivateEndpoints = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new GetKeyVaultStatusResponseProperties(keyVaultUri, keyName, keyVaultResourceId, keyVaultPrivateEndpoints ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(GetKeyVaultStatusResponseProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + GetKeyVaultStatusResponseProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual GetKeyVaultStatusResponseProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeGetKeyVaultStatusResponseProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GetKeyVaultStatusResponseProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponseProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponseProperties.cs new file mode 100644 index 000000000000..b07714a20faa --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GetKeyVaultStatusResponseProperties.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties which represents Change key vault status. + internal partial class GetKeyVaultStatusResponseProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal GetKeyVaultStatusResponseProperties() + { + KeyVaultPrivateEndpoints = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The URI of the key vault/managed HSM that should be used for encryption. + /// The name of the key that should be used for encryption. + /// Azure resource ID of the key vault/managed HSM that should be used for encryption. + /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. + /// Keeps track of any properties unknown to the library. + internal GetKeyVaultStatusResponseProperties(Uri keyVaultUri, string keyName, ResourceIdentifier keyVaultResourceId, IList keyVaultPrivateEndpoints, IDictionary additionalBinaryDataProperties) + { + KeyVaultUri = keyVaultUri; + KeyName = keyName; + KeyVaultResourceId = keyVaultResourceId; + KeyVaultPrivateEndpoints = keyVaultPrivateEndpoints; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The URI of the key vault/managed HSM that should be used for encryption. + public Uri KeyVaultUri { get; } + + /// The name of the key that should be used for encryption. + public string KeyName { get; } + + /// Azure resource ID of the key vault/managed HSM that should be used for encryption. + public ResourceIdentifier KeyVaultResourceId { get; } + + /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. + public IList KeyVaultPrivateEndpoints { get; } = new ChangeTrackingList(); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GlobalFileLockingState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GlobalFileLockingState.cs new file mode 100644 index 000000000000..31bf9ebec3a5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/GlobalFileLockingState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Flag indicating whether the global file lock is enabled for the cache. + public readonly partial struct GlobalFileLockingState : IEquatable + { + private readonly string _value; + /// Global file locking is disabled. + private const string DisabledValue = "Disabled"; + /// Global file locking is enabled. + private const string EnabledValue = "Enabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public GlobalFileLockingState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Global file locking is disabled. + public static GlobalFileLockingState Disabled { get; } = new GlobalFileLockingState(DisabledValue); + + /// Global file locking is enabled. + public static GlobalFileLockingState Enabled { get; } = new GlobalFileLockingState(EnabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(GlobalFileLockingState left, GlobalFileLockingState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(GlobalFileLockingState left, GlobalFileLockingState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator GlobalFileLockingState(string value) => new GlobalFileLockingState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator GlobalFileLockingState?(string value) => value == null ? null : new GlobalFileLockingState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GlobalFileLockingState other && Equals(other); + + /// + public bool Equals(GlobalFileLockingState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/HourlySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/HourlySchedule.Serialization.cs new file mode 100644 index 000000000000..83c25b0fa6e3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/HourlySchedule.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Hourly Schedule properties. + public partial class HourlySchedule : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HourlySchedule)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotsToKeep)) + { + writer.WritePropertyName("snapshotsToKeep"u8); + writer.WriteNumberValue(SnapshotsToKeep.Value); + } + if (Optional.IsDefined(Minute)) + { + writer.WritePropertyName("minute"u8); + writer.WriteNumberValue(Minute.Value); + } + if (Optional.IsDefined(UsedBytes)) + { + writer.WritePropertyName("usedBytes"u8); + writer.WriteNumberValue(UsedBytes.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + HourlySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual HourlySchedule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HourlySchedule)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHourlySchedule(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static HourlySchedule DeserializeHourlySchedule(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? snapshotsToKeep = default; + int? minute = default; + long? usedBytes = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("minute"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minute = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("usedBytes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usedBytes = prop.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new HourlySchedule(snapshotsToKeep, minute, usedBytes, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(HourlySchedule)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + HourlySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual HourlySchedule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeHourlySchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HourlySchedule)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/HourlySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/HourlySchedule.cs new file mode 100644 index 000000000000..ec6d46d5fa39 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/HourlySchedule.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Hourly Schedule properties. + public partial class HourlySchedule + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public HourlySchedule() + { + } + + /// Initializes a new instance of . + /// Hourly snapshot count to keep. + /// Indicates which minute snapshot should be taken. + /// Resource size in bytes, current storage usage for the volume in bytes. + /// Keeps track of any properties unknown to the library. + internal HourlySchedule(int? snapshotsToKeep, int? minute, long? usedBytes, IDictionary additionalBinaryDataProperties) + { + SnapshotsToKeep = snapshotsToKeep; + Minute = minute; + UsedBytes = usedBytes; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Hourly snapshot count to keep. + public int? SnapshotsToKeep { get; set; } + + /// Indicates which minute snapshot should be taken. + public int? Minute { get; set; } + + /// Resource size in bytes, current storage usage for the volume in bytes. + public long? UsedBytes { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/InAvailabilityReasonType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/InAvailabilityReasonType.cs new file mode 100644 index 000000000000..0ddd4a25c8fe --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/InAvailabilityReasonType.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// <code>Invalid</code> indicates the name provided does not match Azure App Service naming requirements. <code>AlreadyExists</code> indicates that the name is already in use and is therefore unavailable. + public readonly partial struct InAvailabilityReasonType : IEquatable + { + private readonly string _value; + private const string InvalidValue = "Invalid"; + private const string AlreadyExistsValue = "AlreadyExists"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public InAvailabilityReasonType(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Invalid. + public static InAvailabilityReasonType Invalid { get; } = new InAvailabilityReasonType(InvalidValue); + + /// Gets the AlreadyExists. + public static InAvailabilityReasonType AlreadyExists { get; } = new InAvailabilityReasonType(AlreadyExistsValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(InAvailabilityReasonType left, InAvailabilityReasonType right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(InAvailabilityReasonType left, InAvailabilityReasonType right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator InAvailabilityReasonType(string value) => new InAvailabilityReasonType(value); + + /// Converts a string to a . + /// The value. + public static implicit operator InAvailabilityReasonType?(string value) => value == null ? null : new InAvailabilityReasonType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InAvailabilityReasonType other && Equals(other); + + /// + public bool Equals(InAvailabilityReasonType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KerberosState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KerberosState.cs new file mode 100644 index 000000000000..4145d8676b57 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KerberosState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Describe if a cache is Kerberos enabled. + public readonly partial struct KerberosState : IEquatable + { + private readonly string _value; + /// Kerberos is disabled. + private const string DisabledValue = "Disabled"; + /// Kerberos is enabled. + private const string EnabledValue = "Enabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public KerberosState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Kerberos is disabled. + public static KerberosState Disabled { get; } = new KerberosState(DisabledValue); + + /// Kerberos is enabled. + public static KerberosState Enabled { get; } = new KerberosState(EnabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(KerberosState left, KerberosState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(KerberosState left, KerberosState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator KerberosState(string value) => new KerberosState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator KerberosState?(string value) => value == null ? null : new KerberosState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KerberosState other && Equals(other); + + /// + public bool Equals(KerberosState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeySource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeySource.cs new file mode 100644 index 000000000000..2fa70b7a71f6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeySource.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The encryption keySource (provider). Possible values (case-insensitive): Microsoft.NetApp, Microsoft.KeyVault. + public readonly partial struct KeySource : IEquatable + { + private readonly string _value; + /// Microsoft-managed key encryption. + private const string MicrosoftNetAppValue = "Microsoft.NetApp"; + /// Customer-managed key encryption. + private const string MicrosoftKeyVaultValue = "Microsoft.KeyVault"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public KeySource(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Microsoft-managed key encryption. + public static KeySource MicrosoftNetApp { get; } = new KeySource(MicrosoftNetAppValue); + + /// Customer-managed key encryption. + public static KeySource MicrosoftKeyVault { get; } = new KeySource(MicrosoftKeyVaultValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(KeySource left, KeySource right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(KeySource left, KeySource right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator KeySource(string value) => new KeySource(value); + + /// Converts a string to a . + /// The value. + public static implicit operator KeySource?(string value) => value == null ? null : new KeySource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KeySource other && Equals(other); + + /// + public bool Equals(KeySource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultPrivateEndpoint.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultPrivateEndpoint.Serialization.cs new file mode 100644 index 000000000000..879cf971c369 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultPrivateEndpoint.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. + public partial class KeyVaultPrivateEndpoint : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyVaultPrivateEndpoint)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(VirtualNetworkId)) + { + writer.WritePropertyName("virtualNetworkId"u8); + writer.WriteStringValue(VirtualNetworkId); + } + if (Optional.IsDefined(PrivateEndpointId)) + { + writer.WritePropertyName("privateEndpointId"u8); + writer.WriteStringValue(PrivateEndpointId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultPrivateEndpoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateEndpoint JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyVaultPrivateEndpoint)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultPrivateEndpoint(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultPrivateEndpoint DeserializeKeyVaultPrivateEndpoint(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier virtualNetworkId = default; + ResourceIdentifier privateEndpointId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("virtualNetworkId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + virtualNetworkId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("privateEndpointId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateEndpointId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new KeyVaultPrivateEndpoint(virtualNetworkId, privateEndpointId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(KeyVaultPrivateEndpoint)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + KeyVaultPrivateEndpoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultPrivateEndpoint PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeKeyVaultPrivateEndpoint(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyVaultPrivateEndpoint)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultPrivateEndpoint.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultPrivateEndpoint.cs new file mode 100644 index 000000000000..94a4f3676be9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultPrivateEndpoint.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. + public partial class KeyVaultPrivateEndpoint + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public KeyVaultPrivateEndpoint() + { + } + + /// Initializes a new instance of . + /// Identifier for the virtual network id. + /// Identifier of the private endpoint to reach the Azure Key Vault. + /// Keeps track of any properties unknown to the library. + internal KeyVaultPrivateEndpoint(ResourceIdentifier virtualNetworkId, ResourceIdentifier privateEndpointId, IDictionary additionalBinaryDataProperties) + { + VirtualNetworkId = virtualNetworkId; + PrivateEndpointId = privateEndpointId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Identifier for the virtual network id. + public ResourceIdentifier VirtualNetworkId { get; set; } + + /// Identifier of the private endpoint to reach the Azure Key Vault. + public ResourceIdentifier PrivateEndpointId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultProperties.Serialization.cs new file mode 100644 index 000000000000..363063eacf45 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultProperties.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of key vault. + public partial class KeyVaultProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal KeyVaultProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyVaultProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(KeyVaultId)) + { + writer.WritePropertyName("keyVaultId"u8); + writer.WriteStringValue(KeyVaultId); + } + writer.WritePropertyName("keyVaultUri"u8); + writer.WriteStringValue(KeyVaultUri.AbsoluteUri); + writer.WritePropertyName("keyName"u8); + writer.WriteStringValue(KeyName); + if (Optional.IsDefined(KeyVaultResourceId)) + { + writer.WritePropertyName("keyVaultResourceId"u8); + writer.WriteStringValue(KeyVaultResourceId); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + KeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual KeyVaultProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyVaultProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string keyVaultId = default; + Uri keyVaultUri = default; + string keyName = default; + ResourceIdentifier keyVaultResourceId = default; + NetAppKeyVaultStatus? status = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("keyVaultId"u8)) + { + keyVaultId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("keyVaultUri"u8)) + { + keyVaultUri = new Uri(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyName"u8)) + { + keyName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("keyVaultResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("status"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new NetAppKeyVaultStatus(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new KeyVaultProperties( + keyVaultId, + keyVaultUri, + keyName, + keyVaultResourceId, + status, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(KeyVaultProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + KeyVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual KeyVaultProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeKeyVaultProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyVaultProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultProperties.cs new file mode 100644 index 000000000000..febbbf4b5955 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/KeyVaultProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of key vault. + public partial class KeyVaultProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The Uri of KeyVault. + /// The name of KeyVault key. + /// or is null. + public KeyVaultProperties(Uri keyVaultUri, string keyName) + { + Argument.AssertNotNull(keyVaultUri, nameof(keyVaultUri)); + Argument.AssertNotNull(keyName, nameof(keyName)); + + KeyVaultUri = keyVaultUri; + KeyName = keyName; + } + + /// Initializes a new instance of . + /// UUID v4 used to identify the Azure Key Vault configuration. + /// The Uri of KeyVault. + /// The name of KeyVault key. + /// The resource ID of KeyVault. + /// Status of the KeyVault connection. + /// Keeps track of any properties unknown to the library. + internal KeyVaultProperties(string keyVaultId, Uri keyVaultUri, string keyName, ResourceIdentifier keyVaultResourceId, NetAppKeyVaultStatus? status, IDictionary additionalBinaryDataProperties) + { + KeyVaultId = keyVaultId; + KeyVaultUri = keyVaultUri; + KeyName = keyName; + KeyVaultResourceId = keyVaultResourceId; + Status = status; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// UUID v4 used to identify the Azure Key Vault configuration. + public string KeyVaultId { get; } + + /// The Uri of KeyVault. + public Uri KeyVaultUri { get; set; } + + /// The name of KeyVault key. + public string KeyName { get; set; } + + /// The resource ID of KeyVault. + public ResourceIdentifier KeyVaultResourceId { get; set; } + + /// Status of the KeyVault connection. + public NetAppKeyVaultStatus? Status { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LargeVolumeType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LargeVolumeType.cs new file mode 100644 index 000000000000..9b78f1682222 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LargeVolumeType.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// + /// Specifies the type of the Large Volume. When set to 'LargeVolume', the large volume is created with standard configuration. + /// If it is set to 'ExtraLargeVolume7Dot2PiB', the extra large volume is created with higher capacity limit 7.2PiB with cool access enabled, + /// delivering higher capacity limit with lower costs. + /// + public readonly partial struct LargeVolumeType : IEquatable + { + private readonly string _value; + /// The large volume is created with standard configuration that provides standard performance and throughput. + private const string LargeVolumeValue = "LargeVolume"; + /// The extra large volume is created with higher volume capacity limit 7.2PiB with cool access enabled, delivering higher capacity limit with lower costs. + private const string ExtraLargeVolume7Dot2PiBValue = "PremExtraLargeVolume7Dot2PiB"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public LargeVolumeType(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// The large volume is created with standard configuration that provides standard performance and throughput. + public static LargeVolumeType LargeVolume { get; } = new LargeVolumeType(LargeVolumeValue); + + /// The extra large volume is created with higher volume capacity limit 7.2PiB with cool access enabled, delivering higher capacity limit with lower costs. + public static LargeVolumeType ExtraLargeVolume7Dot2PiB { get; } = new LargeVolumeType(ExtraLargeVolume7Dot2PiBValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(LargeVolumeType left, LargeVolumeType right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(LargeVolumeType left, LargeVolumeType right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator LargeVolumeType(string value) => new LargeVolumeType(value); + + /// Converts a string to a . + /// The value. + public static implicit operator LargeVolumeType?(string value) => value == null ? null : new LargeVolumeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LargeVolumeType other && Equals(other); + + /// + public bool Equals(LargeVolumeType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapConfiguration.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapConfiguration.Serialization.cs index 7647db3d69d6..8da24f7a273a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapConfiguration.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapConfiguration.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class LdapConfiguration : IUtf8JsonSerializable, IJsonModel + /// LDAP configuration. + public partial class LdapConfiguration : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(LdapConfiguration)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Domain)) { writer.WritePropertyName("domain"u8); @@ -43,16 +43,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("ldapServers"u8); writer.WriteStartArray(); - foreach (var item in LdapServers) + foreach (string item in LdapServers) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); } - if (Optional.IsDefined(LdapOverTls)) + if (Optional.IsDefined(LdapOverTLS)) { writer.WritePropertyName("ldapOverTLS"u8); - writer.WriteBooleanValue(LdapOverTls.Value); + writer.WriteBooleanValue(LdapOverTLS.Value); } if (Optional.IsDefined(ServerCACertificate)) { @@ -61,25 +66,18 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } if (Optional.IsDefined(CertificateCNHost)) { - if (CertificateCNHost != null) - { - writer.WritePropertyName("certificateCNHost"u8); - writer.WriteStringValue(CertificateCNHost); - } - else - { - writer.WriteNull("certificateCNHost"); - } + writer.WritePropertyName("certificateCNHost"u8); + writer.WriteStringValue(CertificateCNHost); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -88,97 +86,110 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LdapConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + LdapConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LdapConfiguration JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(LdapConfiguration)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeLdapConfiguration(document.RootElement, options); } - internal static LdapConfiguration DeserializeLdapConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LdapConfiguration DeserializeLdapConfiguration(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string domain = default; IList ldapServers = default; - bool? ldapOverTls = default; + bool? ldapOverTLS = default; string serverCACertificate = default; string certificateCNHost = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("domain"u8)) + if (prop.NameEquals("domain"u8)) { - domain = property.Value.GetString(); + domain = prop.Value.GetString(); continue; } - if (property.NameEquals("ldapServers"u8)) + if (prop.NameEquals("ldapServers"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(item.GetString()); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } } ldapServers = array; continue; } - if (property.NameEquals("ldapOverTLS"u8)) + if (prop.NameEquals("ldapOverTLS"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - ldapOverTls = property.Value.GetBoolean(); + ldapOverTLS = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("serverCACertificate"u8)) + if (prop.NameEquals("serverCACertificate"u8)) { - serverCACertificate = property.Value.GetString(); + serverCACertificate = prop.Value.GetString(); continue; } - if (property.NameEquals("certificateCNHost"u8)) + if (prop.NameEquals("certificateCNHost"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { certificateCNHost = null; continue; } - certificateCNHost = property.Value.GetString(); + certificateCNHost = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new LdapConfiguration( domain, ldapServers ?? new ChangeTrackingList(), - ldapOverTls, + ldapOverTLS, serverCACertificate, certificateCNHost, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -188,15 +199,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - LdapConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + LdapConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LdapConfiguration PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeLdapConfiguration(document.RootElement, options); } default: @@ -204,6 +220,7 @@ LdapConfiguration IPersistableModel.Create(BinaryData data, M } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapConfiguration.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapConfiguration.cs index 9b4ca6736071..391a62db3943 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapConfiguration.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapConfiguration.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// LDAP configuration. public partial class LdapConfiguration { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public LdapConfiguration() @@ -54,28 +26,32 @@ public LdapConfiguration() /// Initializes a new instance of . /// Name of the LDAP configuration domain. /// List of LDAP server IP addresses (IPv4 only) for the LDAP domain. - /// Specifies whether or not the LDAP traffic needs to be secured via TLS. + /// Specifies whether or not the LDAP traffic needs to be secured via TLS. /// When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded ldap servers CA certificate. /// The CN host name used while generating the certificate, LDAP Over TLS requires the CN host name to create DNS host entry. - /// Keeps track of any properties unknown to the library. - internal LdapConfiguration(string domain, IList ldapServers, bool? ldapOverTls, string serverCACertificate, string certificateCNHost, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal LdapConfiguration(string domain, IList ldapServers, bool? ldapOverTLS, string serverCACertificate, string certificateCNHost, IDictionary additionalBinaryDataProperties) { Domain = domain; LdapServers = ldapServers; - LdapOverTls = ldapOverTls; + LdapOverTLS = ldapOverTLS; ServerCACertificate = serverCACertificate; CertificateCNHost = certificateCNHost; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Name of the LDAP configuration domain. public string Domain { get; set; } + /// List of LDAP server IP addresses (IPv4 only) for the LDAP domain. public IList LdapServers { get; } + /// Specifies whether or not the LDAP traffic needs to be secured via TLS. - public bool? LdapOverTls { get; set; } + public bool? LdapOverTLS { get; set; } + /// When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded ldap servers CA certificate. public string ServerCACertificate { get; set; } + /// The CN host name used while generating the certificate, LDAP Over TLS requires the CN host name to create DNS host entry. public string CertificateCNHost { get; set; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapSearchScopeOpt.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapSearchScopeOpt.Serialization.cs new file mode 100644 index 000000000000..85c237e21ddc --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapSearchScopeOpt.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// LDAP search scope. + public partial class LdapSearchScopeOpt : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LdapSearchScopeOpt)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(UserDN)) + { + writer.WritePropertyName("userDN"u8); + writer.WriteStringValue(UserDN); + } + if (Optional.IsDefined(GroupDN)) + { + writer.WritePropertyName("groupDN"u8); + writer.WriteStringValue(GroupDN); + } + if (Optional.IsDefined(GroupMembershipFilter)) + { + writer.WritePropertyName("groupMembershipFilter"u8); + writer.WriteStringValue(GroupMembershipFilter); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + LdapSearchScopeOpt IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LdapSearchScopeOpt JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LdapSearchScopeOpt)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLdapSearchScopeOpt(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LdapSearchScopeOpt DeserializeLdapSearchScopeOpt(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string userDN = default; + string groupDN = default; + string groupMembershipFilter = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("userDN"u8)) + { + userDN = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("groupDN"u8)) + { + groupDN = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("groupMembershipFilter"u8)) + { + groupMembershipFilter = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new LdapSearchScopeOpt(userDN, groupDN, groupMembershipFilter, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(LdapSearchScopeOpt)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + LdapSearchScopeOpt IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LdapSearchScopeOpt PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeLdapSearchScopeOpt(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LdapSearchScopeOpt)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapSearchScopeOpt.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapSearchScopeOpt.cs new file mode 100644 index 000000000000..eb5f78670fd2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapSearchScopeOpt.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// LDAP search scope. + public partial class LdapSearchScopeOpt + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public LdapSearchScopeOpt() + { + } + + /// Initializes a new instance of . + /// This specifies the user DN, which overrides the base DN for user lookups. + /// This specifies the group DN, which overrides the base DN for group lookups. + /// This specifies the custom LDAP search filter to be used when looking up group membership from LDAP server. + /// Keeps track of any properties unknown to the library. + internal LdapSearchScopeOpt(string userDN, string groupDN, string groupMembershipFilter, IDictionary additionalBinaryDataProperties) + { + UserDN = userDN; + GroupDN = groupDN; + GroupMembershipFilter = groupMembershipFilter; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// This specifies the user DN, which overrides the base DN for user lookups. + public string UserDN { get; set; } + + /// This specifies the group DN, which overrides the base DN for group lookups. + public string GroupDN { get; set; } + + /// This specifies the custom LDAP search filter to be used when looking up group membership from LDAP server. + public string GroupMembershipFilter { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapServerType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapServerType.cs index c15cae6506e3..388b1f577d45 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapServerType.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapServerType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct LdapServerType : IEquatable { private readonly string _value; + /// The volume should use Active Directory for LDAP connections. + private const string ActiveDirectoryValue = "ActiveDirectory"; + /// The volume should use OpenLDAP for LDAP connections. + private const string OpenLDAPValue = "OpenLDAP"; /// Initializes a new instance of . + /// The value. /// is null. public LdapServerType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string ActiveDirectoryValue = "ActiveDirectory"; - private const string OpenLdapValue = "OpenLDAP"; + _value = value; + } /// The volume should use Active Directory for LDAP connections. public static LdapServerType ActiveDirectory { get; } = new LdapServerType(ActiveDirectoryValue); + /// The volume should use OpenLDAP for LDAP connections. - public static LdapServerType OpenLdap { get; } = new LdapServerType(OpenLdapValue); + public static LdapServerType OpenLDAP { get; } = new LdapServerType(OpenLDAPValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(LdapServerType left, LdapServerType right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(LdapServerType left, LdapServerType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator LdapServerType(string value) => new LdapServerType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator LdapServerType?(string value) => value == null ? null : new LdapServerType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is LdapServerType other && Equals(other); - /// + + /// public bool Equals(LdapServerType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapState.cs new file mode 100644 index 000000000000..813601d515df --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LdapState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Specifies whether LDAP is enabled or not. + public readonly partial struct LdapState : IEquatable + { + private readonly string _value; + /// ldap is disabled. + private const string DisabledValue = "Disabled"; + /// ldap is enabled. + private const string EnabledValue = "Enabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public LdapState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// ldap is disabled. + public static LdapState Disabled { get; } = new LdapState(DisabledValue); + + /// ldap is enabled. + public static LdapState Enabled { get; } = new LdapState(EnabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(LdapState left, LdapState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(LdapState left, LdapState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator LdapState(string value) => new LdapState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator LdapState?(string value) => value == null ? null : new LdapState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LdapState other && Equals(other); + + /// + public bool Equals(LdapState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListQuotaReportResponse.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListQuotaReportResponse.Serialization.cs new file mode 100644 index 000000000000..e7290e1b1d3a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListQuotaReportResponse.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Quota Report for volume. + public partial class ListQuotaReportResponse : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListQuotaReportResponse)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (QuotaReport item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ListQuotaReportResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ListQuotaReportResponse JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListQuotaReportResponse)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeListQuotaReportResponse(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ListQuotaReportResponse DeserializeListQuotaReportResponse(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(QuotaReport.DeserializeQuotaReport(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ListQuotaReportResponse(value ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ListQuotaReportResponse)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ListQuotaReportResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ListQuotaReportResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeListQuotaReportResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListQuotaReportResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ListQuotaReportResponse FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeListQuotaReportResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListQuotaReportResponse.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListQuotaReportResponse.cs new file mode 100644 index 000000000000..d53f04423bf3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListQuotaReportResponse.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Quota Report for volume. + public partial class ListQuotaReportResponse + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ListQuotaReportResponse() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of quota reports. + /// Keeps track of any properties unknown to the library. + internal ListQuotaReportResponse(IList value, IDictionary additionalBinaryDataProperties) + { + Value = value; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// List of quota reports. + public IList Value { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplications.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplications.Serialization.cs index a3819564ffa2..af6a1ec29f06 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplications.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplications.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class ListReplications : IUtf8JsonSerializable, IJsonModel + /// List Replications. + internal partial class ListReplications : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ListReplications() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ListReplications)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (Replication item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ListReplications IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ListReplications IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ListReplications JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ListReplications)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeListReplications(document.RootElement, options); } - internal static ListReplications DeserializeListReplications(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ListReplications DeserializeListReplications(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - continue; + array.Add(Replication.DeserializeReplication(item, options)); } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { - array.Add(NetAppVolumeReplication.DeserializeNetAppVolumeReplication(item, options)); + continue; } - value = array; + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ListReplications(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ListReplications(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op } } - ListReplications IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ListReplications IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ListReplications PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeListReplications(document.RootElement, options); } default: @@ -138,6 +163,15 @@ ListReplications IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ListReplications FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeListReplications(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplications.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplications.cs index 6cfd78de7648..1c175428a34c 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplications.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplications.cs @@ -7,60 +7,38 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.NetApp.Models { /// List Replications. internal partial class ListReplications { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal ListReplications() + /// The Replication items on this page. + internal ListReplications(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// A list of replications. - /// Keeps track of any properties unknown to the library. - internal ListReplications(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// The Replication items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ListReplications(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// A list of replications. - public IReadOnlyList Value { get; } + /// The Replication items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplicationsRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplicationsRequest.Serialization.cs new file mode 100644 index 000000000000..b440a49bd5cb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplicationsRequest.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Body for the list replications endpoint. If supplied, the body will be used as a filter for example to exclude deleted replications. If omitted, the endpoint returns all replications. + public partial class ListReplicationsRequest : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListReplicationsRequest)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Exclude)) + { + writer.WritePropertyName("exclude"u8); + writer.WriteStringValue(Exclude.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ListReplicationsRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ListReplicationsRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListReplicationsRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeListReplicationsRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ListReplicationsRequest DeserializeListReplicationsRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Exclude? exclude = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("exclude"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + exclude = new Exclude(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ListReplicationsRequest(exclude, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ListReplicationsRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ListReplicationsRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ListReplicationsRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeListReplicationsRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListReplicationsRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ListReplicationsRequest listReplicationsRequest) + { + if (listReplicationsRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(listReplicationsRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplicationsRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplicationsRequest.cs new file mode 100644 index 000000000000..c0b2abfebfc4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ListReplicationsRequest.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Body for the list replications endpoint. If supplied, the body will be used as a filter for example to exclude deleted replications. If omitted, the endpoint returns all replications. + public partial class ListReplicationsRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ListReplicationsRequest() + { + } + + /// Initializes a new instance of . + /// Exclude Replications filter. 'None' returns all replications, 'Deleted' excludes deleted replications. Default is 'None'. + /// Keeps track of any properties unknown to the library. + internal ListReplicationsRequest(Exclude? exclude, IDictionary additionalBinaryDataProperties) + { + Exclude = exclude; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Exclude Replications filter. 'None' returns all replications, 'Deleted' excludes deleted replications. Default is 'None'. + public Exclude? Exclude { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LogSpecification.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LogSpecification.Serialization.cs new file mode 100644 index 000000000000..37e3cbfc44a6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LogSpecification.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Log Definition of a single resource metric. + public partial class LogSpecification : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LogSpecification)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + LogSpecification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LogSpecification JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LogSpecification)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLogSpecification(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LogSpecification DeserializeLogSpecification(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string displayName = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("displayName"u8)) + { + displayName = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new LogSpecification(name, displayName, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(LogSpecification)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + LogSpecification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LogSpecification PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeLogSpecification(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LogSpecification)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LogSpecification.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LogSpecification.cs new file mode 100644 index 000000000000..3bb425dcf6af --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/LogSpecification.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Log Definition of a single resource metric. + public partial class LogSpecification + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal LogSpecification() + { + } + + /// Initializes a new instance of . + /// Name of log specification. + /// Display name of log specification. + /// Keeps track of any properties unknown to the library. + internal LogSpecification(string name, string displayName, IDictionary additionalBinaryDataProperties) + { + Name = name; + DisplayName = displayName; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Name of log specification. + public string Name { get; } + + /// Display name of log specification. + public string DisplayName { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricAggregationType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricAggregationType.cs new file mode 100644 index 000000000000..cb5726f9de7c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricAggregationType.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// + public readonly partial struct MetricAggregationType : IEquatable + { + private readonly string _value; + private const string AverageValue = "Average"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public MetricAggregationType(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Average. + public static MetricAggregationType Average { get; } = new MetricAggregationType(AverageValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(MetricAggregationType left, MetricAggregationType right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(MetricAggregationType left, MetricAggregationType right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator MetricAggregationType(string value) => new MetricAggregationType(value); + + /// Converts a string to a . + /// The value. + public static implicit operator MetricAggregationType?(string value) => value == null ? null : new MetricAggregationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MetricAggregationType other && Equals(other); + + /// + public bool Equals(MetricAggregationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricSpecification.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricSpecification.Serialization.cs new file mode 100644 index 000000000000..ecf722bd4e4e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricSpecification.Serialization.cs @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Metric specification of operation. + public partial class MetricSpecification : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricSpecification)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(DisplayDescription)) + { + writer.WritePropertyName("displayDescription"u8); + writer.WriteStringValue(DisplayDescription); + } + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + if (Optional.IsCollectionDefined(SupportedAggregationTypes)) + { + writer.WritePropertyName("supportedAggregationTypes"u8); + writer.WriteStartArray(); + foreach (MetricAggregationType item in SupportedAggregationTypes) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SupportedTimeGrainTypes)) + { + writer.WritePropertyName("supportedTimeGrainTypes"u8); + writer.WriteStartArray(); + foreach (string item in SupportedTimeGrainTypes) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(InternalMetricName)) + { + writer.WritePropertyName("internalMetricName"u8); + writer.WriteStringValue(InternalMetricName); + } + if (Optional.IsDefined(EnableRegionalMdmAccount)) + { + writer.WritePropertyName("enableRegionalMdmAccount"u8); + writer.WriteBooleanValue(EnableRegionalMdmAccount.Value); + } + if (Optional.IsDefined(SourceMdmAccount)) + { + writer.WritePropertyName("sourceMdmAccount"u8); + writer.WriteStringValue(SourceMdmAccount); + } + if (Optional.IsDefined(SourceMdmNamespace)) + { + writer.WritePropertyName("sourceMdmNamespace"u8); + writer.WriteStringValue(SourceMdmNamespace); + } + if (Optional.IsCollectionDefined(Dimensions)) + { + writer.WritePropertyName("dimensions"u8); + writer.WriteStartArray(); + foreach (Dimension item in Dimensions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AggregationType)) + { + writer.WritePropertyName("aggregationType"u8); + writer.WriteStringValue(AggregationType); + } + if (Optional.IsDefined(FillGapWithZero)) + { + writer.WritePropertyName("fillGapWithZero"u8); + writer.WriteBooleanValue(FillGapWithZero.Value); + } + if (Optional.IsDefined(Category)) + { + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + } + if (Optional.IsDefined(ResourceIdDimensionNameOverride)) + { + writer.WritePropertyName("resourceIdDimensionNameOverride"u8); + writer.WriteStringValue(ResourceIdDimensionNameOverride); + } + if (Optional.IsDefined(IsInternal)) + { + writer.WritePropertyName("isInternal"u8); + writer.WriteBooleanValue(IsInternal.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + MetricSpecification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MetricSpecification JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetricSpecification)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetricSpecification(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MetricSpecification DeserializeMetricSpecification(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string displayName = default; + string displayDescription = default; + string unit = default; + IList supportedAggregationTypes = default; + IList supportedTimeGrainTypes = default; + string internalMetricName = default; + bool? enableRegionalMdmAccount = default; + string sourceMdmAccount = default; + string sourceMdmNamespace = default; + IList dimensions = default; + string aggregationType = default; + bool? fillGapWithZero = default; + string category = default; + string resourceIdDimensionNameOverride = default; + bool? isInternal = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("displayName"u8)) + { + displayName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("displayDescription"u8)) + { + displayDescription = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("unit"u8)) + { + unit = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("supportedAggregationTypes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(new MetricAggregationType(item.GetString())); + } + supportedAggregationTypes = array; + continue; + } + if (prop.NameEquals("supportedTimeGrainTypes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + supportedTimeGrainTypes = array; + continue; + } + if (prop.NameEquals("internalMetricName"u8)) + { + internalMetricName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("enableRegionalMdmAccount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableRegionalMdmAccount = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("sourceMdmAccount"u8)) + { + sourceMdmAccount = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("sourceMdmNamespace"u8)) + { + sourceMdmNamespace = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("dimensions"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(Dimension.DeserializeDimension(item, options)); + } + dimensions = array; + continue; + } + if (prop.NameEquals("aggregationType"u8)) + { + aggregationType = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("fillGapWithZero"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fillGapWithZero = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("category"u8)) + { + category = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("resourceIdDimensionNameOverride"u8)) + { + resourceIdDimensionNameOverride = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("isInternal"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isInternal = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new MetricSpecification( + name, + displayName, + displayDescription, + unit, + supportedAggregationTypes ?? new ChangeTrackingList(), + supportedTimeGrainTypes ?? new ChangeTrackingList(), + internalMetricName, + enableRegionalMdmAccount, + sourceMdmAccount, + sourceMdmNamespace, + dimensions ?? new ChangeTrackingList(), + aggregationType, + fillGapWithZero, + category, + resourceIdDimensionNameOverride, + isInternal, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(MetricSpecification)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + MetricSpecification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MetricSpecification PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeMetricSpecification(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MetricSpecification)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricSpecification.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricSpecification.cs new file mode 100644 index 000000000000..3e4b731207e0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MetricSpecification.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Metric specification of operation. + public partial class MetricSpecification + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal MetricSpecification() + { + SupportedAggregationTypes = new ChangeTrackingList(); + SupportedTimeGrainTypes = new ChangeTrackingList(); + Dimensions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Name of metric specification. + /// Display name of metric specification. + /// Display description of metric specification. + /// Unit could be Bytes or Count. + /// Support metric aggregation type. + /// The supported time grain types for the metrics. + /// The internal metric name. + /// Whether or not the service is using regional MDM accounts. + /// The source MDM account. + /// The source MDM namespace. + /// Dimensions of blobs, including blob type and access tier. + /// Aggregation type could be Average. + /// The property to decide fill gap with zero or not. + /// The category this metric specification belong to, could be Capacity. + /// Account Resource Id. + /// Whether the metric is internal. + /// Keeps track of any properties unknown to the library. + internal MetricSpecification(string name, string displayName, string displayDescription, string unit, IList supportedAggregationTypes, IList supportedTimeGrainTypes, string internalMetricName, bool? enableRegionalMdmAccount, string sourceMdmAccount, string sourceMdmNamespace, IList dimensions, string aggregationType, bool? fillGapWithZero, string category, string resourceIdDimensionNameOverride, bool? isInternal, IDictionary additionalBinaryDataProperties) + { + Name = name; + DisplayName = displayName; + DisplayDescription = displayDescription; + Unit = unit; + SupportedAggregationTypes = supportedAggregationTypes; + SupportedTimeGrainTypes = supportedTimeGrainTypes; + InternalMetricName = internalMetricName; + EnableRegionalMdmAccount = enableRegionalMdmAccount; + SourceMdmAccount = sourceMdmAccount; + SourceMdmNamespace = sourceMdmNamespace; + Dimensions = dimensions; + AggregationType = aggregationType; + FillGapWithZero = fillGapWithZero; + Category = category; + ResourceIdDimensionNameOverride = resourceIdDimensionNameOverride; + IsInternal = isInternal; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Name of metric specification. + public string Name { get; } + + /// Display name of metric specification. + public string DisplayName { get; } + + /// Display description of metric specification. + public string DisplayDescription { get; } + + /// Unit could be Bytes or Count. + public string Unit { get; } + + /// Support metric aggregation type. + public IList SupportedAggregationTypes { get; } + + /// The supported time grain types for the metrics. + public IList SupportedTimeGrainTypes { get; } + + /// The internal metric name. + public string InternalMetricName { get; } + + /// Whether or not the service is using regional MDM accounts. + public bool? EnableRegionalMdmAccount { get; } + + /// The source MDM account. + public string SourceMdmAccount { get; } + + /// The source MDM namespace. + public string SourceMdmNamespace { get; } + + /// Dimensions of blobs, including blob type and access tier. + public IList Dimensions { get; } + + /// Aggregation type could be Average. + public string AggregationType { get; } + + /// The property to decide fill gap with zero or not. + public bool? FillGapWithZero { get; } + + /// The category this metric specification belong to, could be Capacity. + public string Category { get; } + + /// Account Resource Id. + public string ResourceIdDimensionNameOverride { get; } + + /// Whether the metric is internal. + public bool? IsInternal { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MonthlySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MonthlySchedule.Serialization.cs new file mode 100644 index 000000000000..c165fe686245 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MonthlySchedule.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Monthly Schedule properties. + public partial class MonthlySchedule : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MonthlySchedule)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotsToKeep)) + { + writer.WritePropertyName("snapshotsToKeep"u8); + writer.WriteNumberValue(SnapshotsToKeep.Value); + } + if (Optional.IsDefined(DaysOfMonth)) + { + writer.WritePropertyName("daysOfMonth"u8); + writer.WriteStringValue(DaysOfMonth); + } + if (Optional.IsDefined(Hour)) + { + writer.WritePropertyName("hour"u8); + writer.WriteNumberValue(Hour.Value); + } + if (Optional.IsDefined(Minute)) + { + writer.WritePropertyName("minute"u8); + writer.WriteNumberValue(Minute.Value); + } + if (Optional.IsDefined(UsedBytes)) + { + writer.WritePropertyName("usedBytes"u8); + writer.WriteNumberValue(UsedBytes.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + MonthlySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MonthlySchedule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MonthlySchedule)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMonthlySchedule(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MonthlySchedule DeserializeMonthlySchedule(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? snapshotsToKeep = default; + string daysOfMonth = default; + int? hour = default; + int? minute = default; + long? usedBytes = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("daysOfMonth"u8)) + { + daysOfMonth = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("hour"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hour = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("minute"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minute = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("usedBytes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usedBytes = prop.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new MonthlySchedule( + snapshotsToKeep, + daysOfMonth, + hour, + minute, + usedBytes, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(MonthlySchedule)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + MonthlySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MonthlySchedule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeMonthlySchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MonthlySchedule)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MonthlySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MonthlySchedule.cs new file mode 100644 index 000000000000..f807e0afa7cf --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MonthlySchedule.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Monthly Schedule properties. + public partial class MonthlySchedule + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public MonthlySchedule() + { + } + + /// Initializes a new instance of . + /// Monthly snapshot count to keep. + /// Indicates which days of the month snapshot should be taken. A comma delimited string. + /// Indicates which hour in UTC timezone a snapshot should be taken. + /// Indicates which minute snapshot should be taken. + /// Resource size in bytes, current storage usage for the volume in bytes. + /// Keeps track of any properties unknown to the library. + internal MonthlySchedule(int? snapshotsToKeep, string daysOfMonth, int? hour, int? minute, long? usedBytes, IDictionary additionalBinaryDataProperties) + { + SnapshotsToKeep = snapshotsToKeep; + DaysOfMonth = daysOfMonth; + Hour = hour; + Minute = minute; + UsedBytes = usedBytes; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Monthly snapshot count to keep. + public int? SnapshotsToKeep { get; set; } + + /// Indicates which days of the month snapshot should be taken. A comma delimited string. + public string DaysOfMonth { get; set; } + + /// Indicates which hour in UTC timezone a snapshot should be taken. + public int? Hour { get; set; } + + /// Indicates which minute snapshot should be taken. + public int? Minute { get; set; } + + /// Resource size in bytes, current storage usage for the volume in bytes. + public long? UsedBytes { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MountTargetProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MountTargetProperties.Serialization.cs new file mode 100644 index 000000000000..411b34d9a357 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MountTargetProperties.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Mount target properties. + public partial class MountTargetProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal MountTargetProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MountTargetProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(MountTargetId)) + { + writer.WritePropertyName("mountTargetId"u8); + writer.WriteStringValue(MountTargetId); + } + writer.WritePropertyName("fileSystemId"u8); + writer.WriteStringValue(FileSystemId); + if (options.Format != "W" && Optional.IsDefined(IpAddress)) + { + writer.WritePropertyName("ipAddress"u8); + writer.WriteStringValue(IpAddress); + } + if (Optional.IsDefined(SmbServerFqdn)) + { + writer.WritePropertyName("smbServerFqdn"u8); + writer.WriteStringValue(SmbServerFqdn); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + MountTargetProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MountTargetProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MountTargetProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMountTargetProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MountTargetProperties DeserializeMountTargetProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string mountTargetId = default; + string fileSystemId = default; + string ipAddress = default; + string smbServerFqdn = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("mountTargetId"u8)) + { + mountTargetId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("fileSystemId"u8)) + { + fileSystemId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("ipAddress"u8)) + { + ipAddress = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("smbServerFqdn"u8)) + { + smbServerFqdn = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new MountTargetProperties(mountTargetId, fileSystemId, ipAddress, smbServerFqdn, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(MountTargetProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + MountTargetProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MountTargetProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeMountTargetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MountTargetProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MountTargetProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MountTargetProperties.cs new file mode 100644 index 000000000000..8f9591e795aa --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MountTargetProperties.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Mount target properties. + public partial class MountTargetProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// UUID v4 used to identify the MountTarget. + internal MountTargetProperties(string fileSystemId) + { + FileSystemId = fileSystemId; + } + + /// Initializes a new instance of . + /// UUID v4 used to identify the MountTarget. + /// UUID v4 used to identify the MountTarget. + /// The mount target's IPv4 address. + /// The SMB server's Fully Qualified Domain Name, FQDN. + /// Keeps track of any properties unknown to the library. + internal MountTargetProperties(string mountTargetId, string fileSystemId, string ipAddress, string smbServerFqdn, IDictionary additionalBinaryDataProperties) + { + MountTargetId = mountTargetId; + FileSystemId = fileSystemId; + IpAddress = ipAddress; + SmbServerFqdn = smbServerFqdn; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// UUID v4 used to identify the MountTarget. + public string MountTargetId { get; } + + /// UUID v4 used to identify the MountTarget. + public string FileSystemId { get; } + + /// The mount target's IPv4 address. + public string IpAddress { get; } + + /// The SMB server's Fully Qualified Domain Name, FQDN. + public string SmbServerFqdn { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MultiAdStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MultiAdStatus.cs index c6ca81da38f2..cdc4281df997 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MultiAdStatus.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/MultiAdStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct MultiAdStatus : IEquatable { private readonly string _value; + /// Account is MultiAD disabled, Means its a SharedAD or SingleAD account. + private const string DisabledValue = "Disabled"; + /// Account is MultiAD enabled. + private const string EnabledValue = "Enabled"; /// Initializes a new instance of . + /// The value. /// is null. public MultiAdStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string DisabledValue = "Disabled"; - private const string EnabledValue = "Enabled"; + _value = value; + } /// Account is MultiAD disabled, Means its a SharedAD or SingleAD account. public static MultiAdStatus Disabled { get; } = new MultiAdStatus(DisabledValue); + /// Account is MultiAD enabled. public static MultiAdStatus Enabled { get; } = new MultiAdStatus(EnabledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(MultiAdStatus left, MultiAdStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(MultiAdStatus left, MultiAdStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator MultiAdStatus(string value) => new MultiAdStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator MultiAdStatus?(string value) => value == null ? null : new MultiAdStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is MultiAdStatus other && Equals(other); - /// + + /// public bool Equals(MultiAdStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountActiveDirectoryStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountActiveDirectoryStatus.cs deleted file mode 100644 index 8f37db242eb0..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountActiveDirectoryStatus.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Status of the Active Directory. - public readonly partial struct NetAppAccountActiveDirectoryStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppAccountActiveDirectoryStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CreatedValue = "Created"; - private const string InUseValue = "InUse"; - private const string DeletedValue = "Deleted"; - private const string ErrorValue = "Error"; - private const string UpdatingValue = "Updating"; - - /// Active Directory created but not in use. - public static NetAppAccountActiveDirectoryStatus Created { get; } = new NetAppAccountActiveDirectoryStatus(CreatedValue); - /// Active Directory in use by SMB Volume. - public static NetAppAccountActiveDirectoryStatus InUse { get; } = new NetAppAccountActiveDirectoryStatus(InUseValue); - /// Active Directory Deleted. - public static NetAppAccountActiveDirectoryStatus Deleted { get; } = new NetAppAccountActiveDirectoryStatus(DeletedValue); - /// Error with the Active Directory. - public static NetAppAccountActiveDirectoryStatus Error { get; } = new NetAppAccountActiveDirectoryStatus(ErrorValue); - /// Active Directory Updating. - public static NetAppAccountActiveDirectoryStatus Updating { get; } = new NetAppAccountActiveDirectoryStatus(UpdatingValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppAccountActiveDirectoryStatus left, NetAppAccountActiveDirectoryStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppAccountActiveDirectoryStatus left, NetAppAccountActiveDirectoryStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppAccountActiveDirectoryStatus(string value) => new NetAppAccountActiveDirectoryStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppAccountActiveDirectoryStatus other && Equals(other); - /// - public bool Equals(NetAppAccountActiveDirectoryStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountEncryption.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountEncryption.Serialization.cs deleted file mode 100644 index 101095d10941..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountEncryption.Serialization.cs +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppAccountEncryption : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppAccountEncryption)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(KeySource)) - { - writer.WritePropertyName("keySource"u8); - writer.WriteStringValue(KeySource.Value.ToString()); - } - if (Optional.IsDefined(KeyVaultProperties)) - { - writer.WritePropertyName("keyVaultProperties"u8); - writer.WriteObjectValue(KeyVaultProperties, options); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppAccountEncryption IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppAccountEncryption)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppAccountEncryption(document.RootElement, options); - } - - internal static NetAppAccountEncryption DeserializeNetAppAccountEncryption(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - NetAppKeySource? keySource = default; - NetAppKeyVaultProperties keyVaultProperties = default; - NetAppEncryptionIdentity identity = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("keySource"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keySource = new NetAppKeySource(property.Value.GetString()); - continue; - } - if (property.NameEquals("keyVaultProperties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultProperties = NetAppKeyVaultProperties.DeserializeNetAppKeyVaultProperties(property.Value, options); - continue; - } - if (property.NameEquals("identity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = NetAppEncryptionIdentity.DeserializeNetAppEncryptionIdentity(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppAccountEncryption(keySource, keyVaultProperties, identity, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppAccountEncryption)} does not support writing '{options.Format}' format."); - } - } - - NetAppAccountEncryption IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppAccountEncryption(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppAccountEncryption)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountEncryption.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountEncryption.cs deleted file mode 100644 index b5a2ed87f6f5..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountEncryption.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Encryption settings. - public partial class NetAppAccountEncryption - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppAccountEncryption() - { - } - - /// Initializes a new instance of . - /// The encryption keySource (provider). Possible values (case-insensitive): Microsoft.NetApp, Microsoft.KeyVault. - /// Properties provided by KeVault. Applicable if keySource is 'Microsoft.KeyVault'. - /// Identity used to authenticate to KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. - /// Keeps track of any properties unknown to the library. - internal NetAppAccountEncryption(NetAppKeySource? keySource, NetAppKeyVaultProperties keyVaultProperties, NetAppEncryptionIdentity identity, IDictionary serializedAdditionalRawData) - { - KeySource = keySource; - KeyVaultProperties = keyVaultProperties; - Identity = identity; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The encryption keySource (provider). Possible values (case-insensitive): Microsoft.NetApp, Microsoft.KeyVault. - public NetAppKeySource? KeySource { get; set; } - /// Properties provided by KeVault. Applicable if keySource is 'Microsoft.KeyVault'. - public NetAppKeyVaultProperties KeyVaultProperties { get; set; } - /// Identity used to authenticate to KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. - public NetAppEncryptionIdentity Identity { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountList.Serialization.cs index 6e7771dfe6c0..9c9d36c8b302 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class NetAppAccountList : IUtf8JsonSerializable, IJsonModel + /// List of NetApp account resources. + internal partial class NetAppAccountList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal NetAppAccountList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppAccountList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (NetAppAccountData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NetAppAccountList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + NetAppAccountList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NetAppAccountList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppAccountList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeNetAppAccountList(document.RootElement, options); } - internal static NetAppAccountList DeserializeNetAppAccountList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NetAppAccountList DeserializeNetAppAccountList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(NetAppAccountData.DeserializeNetAppAccountData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppAccountList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new NetAppAccountList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -133,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - NetAppAccountList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + NetAppAccountList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NetAppAccountList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeNetAppAccountList(document.RootElement, options); } default: @@ -149,6 +163,15 @@ NetAppAccountList IPersistableModel.Create(BinaryData data, M } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static NetAppAccountList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeNetAppAccountList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountList.cs index 681b09a1f71e..f4d89f711358 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of NetApp account resources. internal partial class NetAppAccountList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal NetAppAccountList() + /// The NetAppAccount items on this page. + internal NetAppAccountList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Multiple NetApp accounts. - /// URL to get the next set of results. - /// Keeps track of any properties unknown to the library. - internal NetAppAccountList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The NetAppAccount items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal NetAppAccountList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Multiple NetApp accounts. - public IReadOnlyList Value { get; } - /// URL to get the next set of results. - public string NextLink { get; } + /// The NetAppAccount items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountPatch.Serialization.cs index 31e075b0f791..93ca30fbcb1f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountPatch.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountPatch.Serialization.cs @@ -12,13 +12,15 @@ using System.Text.Json; using Azure.Core; using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class NetAppAccountPatch : IUtf8JsonSerializable, IJsonModel + /// NetApp account patch resource. + public partial class NetAppAccountPatch : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,275 +30,193 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// The JSON writer. /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppAccountPatch)} does not support writing '{format}' format."); } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Identity)) + if (Optional.IsDefined(Location)) { - writer.WritePropertyName("identity"u8); - ((IJsonModel)Identity).Write(writer, ModelSerializationExtensions.WireV3Options); + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + if (options.Format != "W" && Optional.IsDefined(Id)) { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); } - if (Optional.IsCollectionDefined(ActiveDirectories)) + if (options.Format != "W" && Optional.IsDefined(Name)) { - writer.WritePropertyName("activeDirectories"u8); - writer.WriteStartArray(); - foreach (var item in ActiveDirectories) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); } - if (Optional.IsDefined(Encryption)) + if (options.Format != "W" && Optional.IsDefined(Type)) { - writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption, options); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); } - if (options.Format != "W" && Optional.IsDefined(DisableShowmount)) + if (Optional.IsCollectionDefined(Tags)) { - if (DisableShowmount != null) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WritePropertyName("disableShowmount"u8); - writer.WriteBooleanValue(DisableShowmount.Value); - } - else - { - writer.WriteNull("disableShowmount"); + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); } + writer.WriteEndObject(); } - if (Optional.IsDefined(NfsV4IdDomain)) + if (Optional.IsDefined(Properties)) { - if (NfsV4IdDomain != null) - { - writer.WritePropertyName("nfsV4IDDomain"u8); - writer.WriteStringValue(NfsV4IdDomain); - } - else - { - writer.WriteNull("nfsV4IDDomain"); - } + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsDefined(MultiAdStatus)) + if (Optional.IsDefined(Identity)) { - writer.WritePropertyName("multiAdStatus"u8); - writer.WriteStringValue(MultiAdStatus.Value.ToString()); + writer.WritePropertyName("identity"u8); + ((IJsonModel)Identity).Write(writer, options); } - if (Optional.IsDefined(LdapConfiguration)) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - writer.WritePropertyName("ldapConfiguration"u8); - writer.WriteObjectValue(LdapConfiguration, options); + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } } - writer.WriteEndObject(); } - NetAppAccountPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + NetAppAccountPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NetAppAccountPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppAccountPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeNetAppAccountPatch(document.RootElement, options); } - internal static NetAppAccountPatch DeserializeNetAppAccountPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NetAppAccountPatch DeserializeNetAppAccountPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - ManagedServiceIdentity identity = default; - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; + string location = default; + string id = default; string name = default; - ResourceType type = default; - SystemData systemData = default; - string provisioningState = default; - IList activeDirectories = default; - NetAppAccountEncryption encryption = default; - bool? disableShowmount = default; - string nfsV4IdDomain = default; - MultiAdStatus? multiAdStatus = default; - LdapConfiguration ldapConfiguration = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + string @type = default; + IDictionary tags = default; + AccountProperties properties = default; + ManagedServiceIdentity identity = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("identity"u8)) + if (prop.NameEquals("location"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireV3Options, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + location = prop.Value.GetString(); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("id"u8)) { - location = new AzureLocation(property.Value.GetString()); + id = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("name"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("type"u8)) { - name = property.Value.GetString(); + @type = prop.Value.GetString(); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("tags"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + properties = AccountProperties.DeserializeAccountProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("identity"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("activeDirectories"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(NetAppAccountActiveDirectory.DeserializeNetAppAccountActiveDirectory(item, options)); - } - activeDirectories = array; - continue; - } - if (property0.NameEquals("encryption"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - encryption = NetAppAccountEncryption.DeserializeNetAppAccountEncryption(property0.Value, options); - continue; - } - if (property0.NameEquals("disableShowmount"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - disableShowmount = null; - continue; - } - disableShowmount = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("nfsV4IDDomain"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - nfsV4IdDomain = null; - continue; - } - nfsV4IdDomain = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("multiAdStatus"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - multiAdStatus = new MultiAdStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("ldapConfiguration"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - ldapConfiguration = LdapConfiguration.DeserializeLdapConfiguration(property0.Value, options); - continue; - } - } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new NetAppAccountPatch( + location, id, name, - type, - systemData, + @type, tags ?? new ChangeTrackingDictionary(), - location, + properties, identity, - provisioningState, - activeDirectories ?? new ChangeTrackingList(), - encryption, - disableShowmount, - nfsV4IdDomain, - multiAdStatus, - ldapConfiguration, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -306,15 +226,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - NetAppAccountPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + NetAppAccountPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NetAppAccountPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeNetAppAccountPatch(document.RootElement, options); } default: @@ -322,6 +247,19 @@ NetAppAccountPatch IPersistableModel.Create(BinaryData data, } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(NetAppAccountPatch netAppAccountPatch) + { + if (netAppAccountPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(netAppAccountPatch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountPatch.cs index 13fc2fa9f160..889c4f521b11 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountPatch.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAccountPatch.cs @@ -7,102 +7,154 @@ using System; using System.Collections.Generic; -using Azure.Core; using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// NetApp account patch resource. - public partial class NetAppAccountPatch : TrackedResourceData + public partial class NetAppAccountPatch { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. - public NetAppAccountPatch(AzureLocation location) : base(location) + public NetAppAccountPatch() { - ActiveDirectories = new ChangeTrackingList(); + Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// NetApp Account properties. /// The identity used for the resource. - /// Azure lifecycle management. - /// Active Directories. - /// Encryption settings. - /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. - /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. - /// MultiAD Status for the account. - /// LDAP Configuration for the account. - /// Keeps track of any properties unknown to the library. - internal NetAppAccountPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, string provisioningState, IList activeDirectories, NetAppAccountEncryption encryption, bool? disableShowmount, string nfsV4IdDomain, MultiAdStatus? multiAdStatus, LdapConfiguration ldapConfiguration, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal NetAppAccountPatch(string location, string id, string name, string @type, IDictionary tags, AccountProperties properties, ManagedServiceIdentity identity, IDictionary additionalBinaryDataProperties) { + Location = location; + Id = id; + Name = name; + Type = @type; + Tags = tags; + Properties = properties; Identity = identity; - ProvisioningState = provisioningState; - ActiveDirectories = activeDirectories; - Encryption = encryption; - DisableShowmount = disableShowmount; - NfsV4IdDomain = nfsV4IdDomain; - MultiAdStatus = multiAdStatus; - LdapConfiguration = ldapConfiguration; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Initializes a new instance of for deserialization. - internal NetAppAccountPatch() - { - } + /// Resource location. + public string Location { get; set; } + + /// Resource Id. + public string Id { get; } + + /// Resource name. + public string Name { get; } + + /// Resource type. + public string Type { get; } + + /// Resource tags. + public IDictionary Tags { get; } + + /// NetApp Account properties. + internal AccountProperties Properties { get; set; } /// The identity used for the resource. public ManagedServiceIdentity Identity { get; set; } + /// Azure lifecycle management. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// Active Directories. - public IList ActiveDirectories { get; } + public IList ActiveDirectories + { + get + { + if (Properties is null) + { + Properties = new AccountProperties(); + } + return Properties.ActiveDirectories; + } + } + /// Encryption settings. - public NetAppAccountEncryption Encryption { get; set; } + public AccountEncryption Encryption + { + get + { + return Properties is null ? default : Properties.Encryption; + } + set + { + if (Properties is null) + { + Properties = new AccountProperties(); + } + Properties.Encryption = value; + } + } + /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. - public bool? DisableShowmount { get; } + public bool? DisableShowmount + { + get + { + return Properties is null ? default : Properties.DisableShowmount; + } + } + /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. - public string NfsV4IdDomain { get; set; } + public string NfsV4IDDomain + { + get + { + return Properties is null ? default : Properties.NfsV4IDDomain; + } + set + { + if (Properties is null) + { + Properties = new AccountProperties(); + } + Properties.NfsV4IDDomain = value; + } + } + /// MultiAD Status for the account. - public MultiAdStatus? MultiAdStatus { get; } + public MultiAdStatus? MultiAdStatus + { + get + { + return Properties is null ? default : Properties.MultiAdStatus; + } + } + /// LDAP Configuration for the account. - public LdapConfiguration LdapConfiguration { get; set; } + public LdapConfiguration LdapConfiguration + { + get + { + return Properties is null ? default : Properties.LdapConfiguration; + } + set + { + if (Properties is null) + { + Properties = new AccountProperties(); + } + Properties.LdapConfiguration = value; + } + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppApplicationType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppApplicationType.cs index b297dd5ebfd6..129292e9cab6 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppApplicationType.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppApplicationType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct NetAppApplicationType : IEquatable { private readonly string _value; + private const string SAPHANAValue = "SAP-HANA"; + private const string ORACLEValue = "ORACLE"; /// Initializes a new instance of . + /// The value. /// is null. public NetAppApplicationType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); + Argument.AssertNotNull(value, nameof(value)); + + _value = value; } - private const string SapHanaValue = "SAP-HANA"; - private const string OracleValue = "ORACLE"; + /// Gets the SAPHANA. + public static NetAppApplicationType SAPHANA { get; } = new NetAppApplicationType(SAPHANAValue); + + /// Gets the ORACLE. + public static NetAppApplicationType ORACLE { get; } = new NetAppApplicationType(ORACLEValue); - /// SAP-HANA. - public static NetAppApplicationType SapHana { get; } = new NetAppApplicationType(SapHanaValue); - /// ORACLE. - public static NetAppApplicationType Oracle { get; } = new NetAppApplicationType(OracleValue); /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(NetAppApplicationType left, NetAppApplicationType right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(NetAppApplicationType left, NetAppApplicationType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator NetAppApplicationType(string value) => new NetAppApplicationType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator NetAppApplicationType?(string value) => value == null ? null : new NetAppApplicationType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is NetAppApplicationType other && Equals(other); - /// + + /// public bool Equals(NetAppApplicationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAvsDataStore.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAvsDataStore.cs deleted file mode 100644 index e54f4557bfaa..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppAvsDataStore.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - public readonly partial struct NetAppAvsDataStore : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppAvsDataStore(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// avsDataStore is enabled. - public static NetAppAvsDataStore Enabled { get; } = new NetAppAvsDataStore(EnabledValue); - /// avsDataStore is disabled. - public static NetAppAvsDataStore Disabled { get; } = new NetAppAvsDataStore(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppAvsDataStore left, NetAppAvsDataStore right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppAvsDataStore left, NetAppAvsDataStore right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppAvsDataStore(string value) => new NetAppAvsDataStore(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppAvsDataStore other && Equals(other); - /// - public bool Equals(NetAppAvsDataStore other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupPolicyPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupPolicyPatch.Serialization.cs deleted file mode 100644 index 4dd7bb08d91b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupPolicyPatch.Serialization.cs +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppBackupPolicyPatch : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupPolicyPatch)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(BackupPolicyId)) - { - writer.WritePropertyName("backupPolicyId"u8); - writer.WriteStringValue(BackupPolicyId); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsDefined(DailyBackupsToKeep)) - { - writer.WritePropertyName("dailyBackupsToKeep"u8); - writer.WriteNumberValue(DailyBackupsToKeep.Value); - } - if (Optional.IsDefined(WeeklyBackupsToKeep)) - { - writer.WritePropertyName("weeklyBackupsToKeep"u8); - writer.WriteNumberValue(WeeklyBackupsToKeep.Value); - } - if (Optional.IsDefined(MonthlyBackupsToKeep)) - { - writer.WritePropertyName("monthlyBackupsToKeep"u8); - writer.WriteNumberValue(MonthlyBackupsToKeep.Value); - } - if (options.Format != "W" && Optional.IsDefined(VolumesAssigned)) - { - writer.WritePropertyName("volumesAssigned"u8); - writer.WriteNumberValue(VolumesAssigned.Value); - } - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); - } - if (options.Format != "W" && Optional.IsCollectionDefined(VolumeBackups)) - { - writer.WritePropertyName("volumeBackups"u8); - writer.WriteStartArray(); - foreach (var item in VolumeBackups) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - - NetAppBackupPolicyPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupPolicyPatch)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBackupPolicyPatch(document.RootElement, options); - } - - internal static NetAppBackupPolicyPatch DeserializeNetAppBackupPolicyPatch(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - ResourceIdentifier backupPolicyId = default; - string provisioningState = default; - int? dailyBackupsToKeep = default; - int? weeklyBackupsToKeep = default; - int? monthlyBackupsToKeep = default; - int? volumesAssigned = default; - bool? enabled = default; - IReadOnlyList volumeBackups = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("backupPolicyId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - backupPolicyId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("dailyBackupsToKeep"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dailyBackupsToKeep = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("weeklyBackupsToKeep"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - weeklyBackupsToKeep = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("monthlyBackupsToKeep"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - monthlyBackupsToKeep = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("volumesAssigned"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - volumesAssigned = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("enabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("volumeBackups"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(NetAppVolumeBackupDetail.DeserializeNetAppVolumeBackupDetail(item, options)); - } - volumeBackups = array; - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBackupPolicyPatch( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - backupPolicyId, - provisioningState, - dailyBackupsToKeep, - weeklyBackupsToKeep, - monthlyBackupsToKeep, - volumesAssigned, - enabled, - volumeBackups ?? new ChangeTrackingList(), - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBackupPolicyPatch)} does not support writing '{options.Format}' format."); - } - } - - NetAppBackupPolicyPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBackupPolicyPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBackupPolicyPatch)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupPolicyPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupPolicyPatch.cs deleted file mode 100644 index 50f2504ee33f..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupPolicyPatch.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Backup policy Details for create and update. - public partial class NetAppBackupPolicyPatch : TrackedResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The location. - public NetAppBackupPolicyPatch(AzureLocation location) : base(location) - { - VolumeBackups = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Backup Policy GUID ID. - /// Azure lifecycle management. - /// Daily backups count to keep. - /// Weekly backups count to keep. - /// Monthly backups count to keep. - /// Volumes using current backup policy. - /// The property to decide policy is enabled or not. - /// A list of volumes assigned to this policy. - /// Keeps track of any properties unknown to the library. - internal NetAppBackupPolicyPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ResourceIdentifier backupPolicyId, string provisioningState, int? dailyBackupsToKeep, int? weeklyBackupsToKeep, int? monthlyBackupsToKeep, int? volumesAssigned, bool? isEnabled, IReadOnlyList volumeBackups, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) - { - BackupPolicyId = backupPolicyId; - ProvisioningState = provisioningState; - DailyBackupsToKeep = dailyBackupsToKeep; - WeeklyBackupsToKeep = weeklyBackupsToKeep; - MonthlyBackupsToKeep = monthlyBackupsToKeep; - VolumesAssigned = volumesAssigned; - IsEnabled = isEnabled; - VolumeBackups = volumeBackups; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppBackupPolicyPatch() - { - } - - /// Backup Policy GUID ID. - public ResourceIdentifier BackupPolicyId { get; } - /// Azure lifecycle management. - public string ProvisioningState { get; } - /// Daily backups count to keep. - public int? DailyBackupsToKeep { get; set; } - /// Weekly backups count to keep. - public int? WeeklyBackupsToKeep { get; set; } - /// Monthly backups count to keep. - public int? MonthlyBackupsToKeep { get; set; } - /// Volumes using current backup policy. - public int? VolumesAssigned { get; } - /// The property to decide policy is enabled or not. - public bool? IsEnabled { get; set; } - /// A list of volumes assigned to this policy. - public IReadOnlyList VolumeBackups { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupType.cs index 7869e20d2d3b..ebee03df82ae 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupType.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct NetAppBackupType : IEquatable { private readonly string _value; + /// Manual backup. + private const string ManualValue = "Manual"; + /// Scheduled backup. + private const string ScheduledValue = "Scheduled"; /// Initializes a new instance of . + /// The value. /// is null. public NetAppBackupType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string ManualValue = "Manual"; - private const string ScheduledValue = "Scheduled"; + _value = value; + } /// Manual backup. public static NetAppBackupType Manual { get; } = new NetAppBackupType(ManualValue); + /// Scheduled backup. public static NetAppBackupType Scheduled { get; } = new NetAppBackupType(ScheduledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(NetAppBackupType left, NetAppBackupType right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(NetAppBackupType left, NetAppBackupType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator NetAppBackupType(string value) => new NetAppBackupType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator NetAppBackupType?(string value) => value == null ? null : new NetAppBackupType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is NetAppBackupType other && Equals(other); - /// + + /// public bool Equals(NetAppBackupType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultBackupPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultBackupPatch.Serialization.cs deleted file mode 100644 index 425e45cdbedf..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultBackupPatch.Serialization.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppBackupVaultBackupPatch : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupVaultBackupPatch)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Label)) - { - writer.WritePropertyName("label"u8); - writer.WriteStringValue(Label); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppBackupVaultBackupPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupVaultBackupPatch)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBackupVaultBackupPatch(document.RootElement, options); - } - - internal static NetAppBackupVaultBackupPatch DeserializeNetAppBackupVaultBackupPatch(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string label = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("label"u8)) - { - label = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBackupVaultBackupPatch(label, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBackupVaultBackupPatch)} does not support writing '{options.Format}' format."); - } - } - - NetAppBackupVaultBackupPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBackupVaultBackupPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBackupVaultBackupPatch)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultBackupPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultBackupPatch.cs deleted file mode 100644 index 2f252d764d79..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultBackupPatch.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Backup patch. - public partial class NetAppBackupVaultBackupPatch - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppBackupVaultBackupPatch() - { - } - - /// Initializes a new instance of . - /// Label for backup. - /// Keeps track of any properties unknown to the library. - internal NetAppBackupVaultBackupPatch(string label, IDictionary serializedAdditionalRawData) - { - Label = label; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Label for backup. - public string Label { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultPatch.Serialization.cs deleted file mode 100644 index 8f189c9f6073..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultPatch.Serialization.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppBackupVaultPatch : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupVaultPatch)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppBackupVaultPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupVaultPatch)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBackupVaultPatch(document.RootElement, options); - } - - internal static NetAppBackupVaultPatch DeserializeNetAppBackupVaultPatch(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IDictionary tags = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBackupVaultPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBackupVaultPatch)} does not support writing '{options.Format}' format."); - } - } - - NetAppBackupVaultPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBackupVaultPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBackupVaultPatch)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultPatch.cs deleted file mode 100644 index 1816a5b66afe..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBackupVaultPatch.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Backup Vault information. - public partial class NetAppBackupVaultPatch - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppBackupVaultPatch() - { - Tags = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// Resource tags. - /// Keeps track of any properties unknown to the library. - internal NetAppBackupVaultPatch(IDictionary tags, IDictionary serializedAdditionalRawData) - { - Tags = tags; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Resource tags. - public IDictionary Tags { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialStatus.cs deleted file mode 100644 index 55915982fda1..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialStatus.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// - /// The bucket credentials status. There states: - /// - /// "NoCredentialsSet": Access and Secret key pair have not been generated. - /// "CredentialsExpired": Access and Secret key pair have expired. - /// "Active": The certificate has been installed and credentials are unexpired. - /// - public readonly partial struct NetAppBucketCredentialStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppBucketCredentialStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NoCredentialsSetValue = "NoCredentialsSet"; - private const string CredentialsExpiredValue = "CredentialsExpired"; - private const string ActiveValue = "Active"; - - /// Access and Secret key pair have not been generated. - public static NetAppBucketCredentialStatus NoCredentialsSet { get; } = new NetAppBucketCredentialStatus(NoCredentialsSetValue); - /// Access and Secret key pair have expired. - public static NetAppBucketCredentialStatus CredentialsExpired { get; } = new NetAppBucketCredentialStatus(CredentialsExpiredValue); - /// The certificate has been installed on the bucket server and the bucket credentials are unexpired. - public static NetAppBucketCredentialStatus Active { get; } = new NetAppBucketCredentialStatus(ActiveValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppBucketCredentialStatus left, NetAppBucketCredentialStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppBucketCredentialStatus left, NetAppBucketCredentialStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppBucketCredentialStatus(string value) => new NetAppBucketCredentialStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppBucketCredentialStatus other && Equals(other); - /// - public bool Equals(NetAppBucketCredentialStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialsExpiry.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialsExpiry.Serialization.cs deleted file mode 100644 index 399f220f2ce0..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialsExpiry.Serialization.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppBucketCredentialsExpiry : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketCredentialsExpiry)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(KeyPairExpiryDays)) - { - writer.WritePropertyName("keyPairExpiryDays"u8); - writer.WriteNumberValue(KeyPairExpiryDays.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppBucketCredentialsExpiry IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketCredentialsExpiry)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBucketCredentialsExpiry(document.RootElement, options); - } - - internal static NetAppBucketCredentialsExpiry DeserializeNetAppBucketCredentialsExpiry(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? keyPairExpiryDays = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("keyPairExpiryDays"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyPairExpiryDays = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBucketCredentialsExpiry(keyPairExpiryDays, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBucketCredentialsExpiry)} does not support writing '{options.Format}' format."); - } - } - - NetAppBucketCredentialsExpiry IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBucketCredentialsExpiry(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBucketCredentialsExpiry)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialsExpiry.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialsExpiry.cs deleted file mode 100644 index 401d36eb234a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketCredentialsExpiry.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// The bucket's Access and Secret key pair Expiry Time expressed as the number of days from now. - public partial class NetAppBucketCredentialsExpiry - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppBucketCredentialsExpiry() - { - } - - /// Initializes a new instance of . - /// The number of days from now until the newly generated Access and Secret key pair will expire. - /// Keeps track of any properties unknown to the library. - internal NetAppBucketCredentialsExpiry(int? keyPairExpiryDays, IDictionary serializedAdditionalRawData) - { - KeyPairExpiryDays = keyPairExpiryDays; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The number of days from now until the newly generated Access and Secret key pair will expire. - public int? KeyPairExpiryDays { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketFileSystemUser.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketFileSystemUser.Serialization.cs deleted file mode 100644 index 75ce04ee5e66..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketFileSystemUser.Serialization.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppBucketFileSystemUser : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketFileSystemUser)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(NfsUser)) - { - writer.WritePropertyName("nfsUser"u8); - writer.WriteObjectValue(NfsUser, options); - } - if (Optional.IsDefined(CifsUser)) - { - writer.WritePropertyName("cifsUser"u8); - writer.WriteObjectValue(CifsUser, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppBucketFileSystemUser IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketFileSystemUser)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBucketFileSystemUser(document.RootElement, options); - } - - internal static NetAppBucketFileSystemUser DeserializeNetAppBucketFileSystemUser(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - NetAppBucketNfsUser nfsUser = default; - CifsUser cifsUser = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("nfsUser"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nfsUser = NetAppBucketNfsUser.DeserializeNetAppBucketNfsUser(property.Value, options); - continue; - } - if (property.NameEquals("cifsUser"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - cifsUser = CifsUser.DeserializeCifsUser(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBucketFileSystemUser(nfsUser, cifsUser, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBucketFileSystemUser)} does not support writing '{options.Format}' format."); - } - } - - NetAppBucketFileSystemUser IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBucketFileSystemUser(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBucketFileSystemUser)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketFileSystemUser.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketFileSystemUser.cs deleted file mode 100644 index ba753157c396..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketFileSystemUser.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. - public partial class NetAppBucketFileSystemUser - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppBucketFileSystemUser() - { - } - - /// Initializes a new instance of . - /// The effective NFS User ID and Group ID when accessing the volume data. - /// The effective CIFS username when accessing the volume data. - /// Keeps track of any properties unknown to the library. - internal NetAppBucketFileSystemUser(NetAppBucketNfsUser nfsUser, CifsUser cifsUser, IDictionary serializedAdditionalRawData) - { - NfsUser = nfsUser; - CifsUser = cifsUser; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The effective NFS User ID and Group ID when accessing the volume data. - public NetAppBucketNfsUser NfsUser { get; set; } - /// The effective CIFS username when accessing the volume data. - internal CifsUser CifsUser { get; set; } - /// The CIFS user's username. - public string CifsUserUsername - { - get => CifsUser is null ? default : CifsUser.Username; - set - { - if (CifsUser is null) - CifsUser = new CifsUser(); - CifsUser.Username = value; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketGenerateCredentials.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketGenerateCredentials.Serialization.cs deleted file mode 100644 index c643198ae044..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketGenerateCredentials.Serialization.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppBucketGenerateCredentials : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketGenerateCredentials)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsDefined(AccessKey)) - { - writer.WritePropertyName("accessKey"u8); - writer.WriteStringValue(AccessKey); - } - if (options.Format != "W" && Optional.IsDefined(SecretKey)) - { - writer.WritePropertyName("secretKey"u8); - writer.WriteStringValue(SecretKey); - } - if (options.Format != "W" && Optional.IsDefined(KeyPairExpiry)) - { - writer.WritePropertyName("keyPairExpiry"u8); - writer.WriteStringValue(KeyPairExpiry.Value, "O"); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppBucketGenerateCredentials IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketGenerateCredentials)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBucketGenerateCredentials(document.RootElement, options); - } - - internal static NetAppBucketGenerateCredentials DeserializeNetAppBucketGenerateCredentials(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string accessKey = default; - string secretKey = default; - DateTimeOffset? keyPairExpiry = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("accessKey"u8)) - { - accessKey = property.Value.GetString(); - continue; - } - if (property.NameEquals("secretKey"u8)) - { - secretKey = property.Value.GetString(); - continue; - } - if (property.NameEquals("keyPairExpiry"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyPairExpiry = property.Value.GetDateTimeOffset("O"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBucketGenerateCredentials(accessKey, secretKey, keyPairExpiry, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBucketGenerateCredentials)} does not support writing '{options.Format}' format."); - } - } - - NetAppBucketGenerateCredentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBucketGenerateCredentials(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBucketGenerateCredentials)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketGenerateCredentials.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketGenerateCredentials.cs deleted file mode 100644 index e37c94e2c3b4..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketGenerateCredentials.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Bucket Access Key, Secret Key, and Expiry date and time of the key pair. - public partial class NetAppBucketGenerateCredentials - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppBucketGenerateCredentials() - { - } - - /// Initializes a new instance of . - /// The Access Key that is required along with the Secret Key to access the bucket. - /// The Secret Key that is required along with the Access Key to access the bucket. - /// The bucket's Access and Secret key pair expiry date and time (in UTC). - /// Keeps track of any properties unknown to the library. - internal NetAppBucketGenerateCredentials(string accessKey, string secretKey, DateTimeOffset? keyPairExpiry, IDictionary serializedAdditionalRawData) - { - AccessKey = accessKey; - SecretKey = secretKey; - KeyPairExpiry = keyPairExpiry; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The Access Key that is required along with the Secret Key to access the bucket. - public string AccessKey { get; } - /// The Secret Key that is required along with the Access Key to access the bucket. - public string SecretKey { get; } - /// The bucket's Access and Secret key pair expiry date and time (in UTC). - public DateTimeOffset? KeyPairExpiry { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketList.Serialization.cs deleted file mode 100644 index 325b42c2c31a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketList.Serialization.cs +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - internal partial class NetAppBucketList : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketList)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Value)) - { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(NextLink)) - { - writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppBucketList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketList)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBucketList(document.RootElement, options); - } - - internal static NetAppBucketList DeserializeNetAppBucketList(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(NetAppBucketData.DeserializeNetAppBucketData(item, options)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBucketList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBucketList)} does not support writing '{options.Format}' format."); - } - } - - NetAppBucketList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBucketList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBucketList)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketList.cs deleted file mode 100644 index 995af7fa4c4f..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketList.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// List of volume bucket resources. - internal partial class NetAppBucketList - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppBucketList() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// List of volume buckets. - /// URL to get the next set of results. - /// Keeps track of any properties unknown to the library. - internal NetAppBucketList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// List of volume buckets. - public IReadOnlyList Value { get; } - /// URL to get the next set of results. - public string NextLink { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketNfsUser.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketNfsUser.Serialization.cs deleted file mode 100644 index 4991ab77a5de..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketNfsUser.Serialization.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppBucketNfsUser : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketNfsUser)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(UserId)) - { - writer.WritePropertyName("userId"u8); - writer.WriteNumberValue(UserId.Value); - } - if (Optional.IsDefined(GroupId)) - { - writer.WritePropertyName("groupId"u8); - writer.WriteNumberValue(GroupId.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppBucketNfsUser IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketNfsUser)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBucketNfsUser(document.RootElement, options); - } - - internal static NetAppBucketNfsUser DeserializeNetAppBucketNfsUser(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - long? userId = default; - long? groupId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("userId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - userId = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("groupId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - groupId = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBucketNfsUser(userId, groupId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBucketNfsUser)} does not support writing '{options.Format}' format."); - } - } - - NetAppBucketNfsUser IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBucketNfsUser(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBucketNfsUser)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketNfsUser.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketNfsUser.cs deleted file mode 100644 index 898ed0c2514a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketNfsUser.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// The effective NFS User ID and Group ID when accessing the volume data. - public partial class NetAppBucketNfsUser - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppBucketNfsUser() - { - } - - /// Initializes a new instance of . - /// The NFS user's UID. - /// The NFS user's GID. - /// Keeps track of any properties unknown to the library. - internal NetAppBucketNfsUser(long? userId, long? groupId, IDictionary serializedAdditionalRawData) - { - UserId = userId; - GroupId = groupId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The NFS user's UID. - public long? UserId { get; set; } - /// The NFS user's GID. - public long? GroupId { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatch.Serialization.cs deleted file mode 100644 index dc5b26b31111..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatch.Serialization.cs +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppBucketPatch : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketPatch)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Path)) - { - writer.WritePropertyName("path"u8); - writer.WriteStringValue(Path); - } - if (Optional.IsDefined(FileSystemUser)) - { - writer.WritePropertyName("fileSystemUser"u8); - writer.WriteObjectValue(FileSystemUser, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToSerialString()); - } - if (Optional.IsDefined(Server)) - { - writer.WritePropertyName("server"u8); - writer.WriteObjectValue(Server, options); - } - if (Optional.IsDefined(Permissions)) - { - writer.WritePropertyName("permissions"u8); - writer.WriteStringValue(Permissions.Value.ToString()); - } - writer.WriteEndObject(); - } - - NetAppBucketPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketPatch)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBucketPatch(document.RootElement, options); - } - - internal static NetAppBucketPatch DeserializeNetAppBucketPatch(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string path = default; - NetAppBucketFileSystemUser fileSystemUser = default; - NetAppProvisioningState? provisioningState = default; - NetAppBucketServerPatchProperties server = default; - NetAppBucketPatchPermission? permissions = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("path"u8)) - { - path = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("fileSystemUser"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fileSystemUser = NetAppBucketFileSystemUser.DeserializeNetAppBucketFileSystemUser(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = property0.Value.GetString().ToNetAppProvisioningState(); - continue; - } - if (property0.NameEquals("server"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - server = NetAppBucketServerPatchProperties.DeserializeNetAppBucketServerPatchProperties(property0.Value, options); - continue; - } - if (property0.NameEquals("permissions"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - permissions = new NetAppBucketPatchPermission(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBucketPatch( - id, - name, - type, - systemData, - path, - fileSystemUser, - provisioningState, - server, - permissions, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBucketPatch)} does not support writing '{options.Format}' format."); - } - } - - NetAppBucketPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBucketPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBucketPatch)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatch.cs deleted file mode 100644 index 32c01890a14a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatch.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Bucket resource. - public partial class NetAppBucketPatch : ResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppBucketPatch() - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The volume path mounted inside the bucket. - /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. - /// Provisioning state of the resource. - /// Properties of the server managing the lifecycle of volume buckets. - /// Access permissions for the bucket. Either ReadOnly or ReadWrite. - /// Keeps track of any properties unknown to the library. - internal NetAppBucketPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string path, NetAppBucketFileSystemUser fileSystemUser, NetAppProvisioningState? provisioningState, NetAppBucketServerPatchProperties server, NetAppBucketPatchPermission? permissions, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Path = path; - FileSystemUser = fileSystemUser; - ProvisioningState = provisioningState; - Server = server; - Permissions = permissions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The volume path mounted inside the bucket. - public string Path { get; set; } - /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. - public NetAppBucketFileSystemUser FileSystemUser { get; set; } - /// Provisioning state of the resource. - public NetAppProvisioningState? ProvisioningState { get; } - /// Properties of the server managing the lifecycle of volume buckets. - public NetAppBucketServerPatchProperties Server { get; set; } - /// Access permissions for the bucket. Either ReadOnly or ReadWrite. - public NetAppBucketPatchPermission? Permissions { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatchPermission.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatchPermission.cs deleted file mode 100644 index c0230c983b0f..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPatchPermission.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Access permissions for the bucket. Either ReadOnly or ReadWrite. - public readonly partial struct NetAppBucketPatchPermission : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppBucketPatchPermission(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ReadOnlyValue = "ReadOnly"; - private const string ReadWriteValue = "ReadWrite"; - - /// Read-only access to bucket. - public static NetAppBucketPatchPermission ReadOnly { get; } = new NetAppBucketPatchPermission(ReadOnlyValue); - /// Read-write access to bucket. - public static NetAppBucketPatchPermission ReadWrite { get; } = new NetAppBucketPatchPermission(ReadWriteValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppBucketPatchPermission left, NetAppBucketPatchPermission right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppBucketPatchPermission left, NetAppBucketPatchPermission right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppBucketPatchPermission(string value) => new NetAppBucketPatchPermission(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppBucketPatchPermission other && Equals(other); - /// - public bool Equals(NetAppBucketPatchPermission other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPermission.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPermission.cs deleted file mode 100644 index 4847072ebdad..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketPermission.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Access permissions for the bucket. Either ReadOnly or ReadWrite. The default is ReadOnly if no value is provided during bucket creation. - public readonly partial struct NetAppBucketPermission : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppBucketPermission(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ReadOnlyValue = "ReadOnly"; - private const string ReadWriteValue = "ReadWrite"; - - /// Read-only access to bucket. - public static NetAppBucketPermission ReadOnly { get; } = new NetAppBucketPermission(ReadOnlyValue); - /// Read-write access to bucket. - public static NetAppBucketPermission ReadWrite { get; } = new NetAppBucketPermission(ReadWriteValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppBucketPermission left, NetAppBucketPermission right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppBucketPermission left, NetAppBucketPermission right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppBucketPermission(string value) => new NetAppBucketPermission(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppBucketPermission other && Equals(other); - /// - public bool Equals(NetAppBucketPermission other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerPatchProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerPatchProperties.Serialization.cs deleted file mode 100644 index 7f99e790fe38..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerPatchProperties.Serialization.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppBucketServerPatchProperties : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketServerPatchProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Fqdn)) - { - writer.WritePropertyName("fqdn"u8); - writer.WriteStringValue(Fqdn); - } - if (Optional.IsDefined(CertificateObject)) - { - writer.WritePropertyName("certificateObject"u8); - writer.WriteStringValue(CertificateObject); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppBucketServerPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketServerPatchProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBucketServerPatchProperties(document.RootElement, options); - } - - internal static NetAppBucketServerPatchProperties DeserializeNetAppBucketServerPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string fqdn = default; - string certificateObject = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("fqdn"u8)) - { - fqdn = property.Value.GetString(); - continue; - } - if (property.NameEquals("certificateObject"u8)) - { - certificateObject = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBucketServerPatchProperties(fqdn, certificateObject, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBucketServerPatchProperties)} does not support writing '{options.Format}' format."); - } - } - - NetAppBucketServerPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBucketServerPatchProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBucketServerPatchProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerPatchProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerPatchProperties.cs deleted file mode 100644 index 889123334809..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerPatchProperties.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Properties of the server managing the lifecycle of volume buckets. - public partial class NetAppBucketServerPatchProperties - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppBucketServerPatchProperties() - { - } - - /// Initializes a new instance of . - /// The host part of the bucket URL, resolving to the bucket IP address and allowed by the server certificate. - /// A base64-encoded PEM file, which includes both the bucket server's certificate and private key. It is used to authenticate the user and allows access to volume data in a read-only manner. - /// Keeps track of any properties unknown to the library. - internal NetAppBucketServerPatchProperties(string fqdn, string certificateObject, IDictionary serializedAdditionalRawData) - { - Fqdn = fqdn; - CertificateObject = certificateObject; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The host part of the bucket URL, resolving to the bucket IP address and allowed by the server certificate. - public string Fqdn { get; set; } - /// A base64-encoded PEM file, which includes both the bucket server's certificate and private key. It is used to authenticate the user and allows access to volume data in a read-only manner. - public string CertificateObject { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerProperties.Serialization.cs deleted file mode 100644 index 97e793b890e2..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerProperties.Serialization.cs +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppBucketServerProperties : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketServerProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Fqdn)) - { - writer.WritePropertyName("fqdn"u8); - writer.WriteStringValue(Fqdn); - } - if (options.Format != "W" && Optional.IsDefined(CertificateCommonName)) - { - writer.WritePropertyName("certificateCommonName"u8); - writer.WriteStringValue(CertificateCommonName); - } - if (options.Format != "W" && Optional.IsDefined(CertificateExpiryOn)) - { - writer.WritePropertyName("certificateExpiryDate"u8); - writer.WriteStringValue(CertificateExpiryOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(IPAddress)) - { - writer.WritePropertyName("ipAddress"u8); - writer.WriteStringValue(IPAddress); - } - if (Optional.IsDefined(CertificateObject)) - { - writer.WritePropertyName("certificateObject"u8); - writer.WriteStringValue(CertificateObject); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppBucketServerProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketServerProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBucketServerProperties(document.RootElement, options); - } - - internal static NetAppBucketServerProperties DeserializeNetAppBucketServerProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string fqdn = default; - string certificateCommonName = default; - DateTimeOffset? certificateExpiryDate = default; - string ipAddress = default; - string certificateObject = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("fqdn"u8)) - { - fqdn = property.Value.GetString(); - continue; - } - if (property.NameEquals("certificateCommonName"u8)) - { - certificateCommonName = property.Value.GetString(); - continue; - } - if (property.NameEquals("certificateExpiryDate"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - certificateExpiryDate = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("ipAddress"u8)) - { - ipAddress = property.Value.GetString(); - continue; - } - if (property.NameEquals("certificateObject"u8)) - { - certificateObject = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBucketServerProperties( - fqdn, - certificateCommonName, - certificateExpiryDate, - ipAddress, - certificateObject, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBucketServerProperties)} does not support writing '{options.Format}' format."); - } - } - - NetAppBucketServerProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBucketServerProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBucketServerProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerProperties.cs deleted file mode 100644 index 44290ed3d86a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppBucketServerProperties.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Properties of the server managing the lifecycle of volume buckets. - public partial class NetAppBucketServerProperties - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppBucketServerProperties() - { - } - - /// Initializes a new instance of . - /// The host part of the bucket URL, resolving to the bucket IP address and allowed by the server certificate. - /// Certificate Common Name taken from the certificate installed on the bucket server. - /// The bucket server's certificate expiry date. - /// The bucket server's IPv4 address. - /// A base64-encoded PEM file, which includes both the bucket server's certificate and private key. It is used to authenticate the user and allows access to volume data in a read-only manner. - /// Keeps track of any properties unknown to the library. - internal NetAppBucketServerProperties(string fqdn, string certificateCommonName, DateTimeOffset? certificateExpiryOn, string ipAddress, string certificateObject, IDictionary serializedAdditionalRawData) - { - Fqdn = fqdn; - CertificateCommonName = certificateCommonName; - CertificateExpiryOn = certificateExpiryOn; - IPAddress = ipAddress; - CertificateObject = certificateObject; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The host part of the bucket URL, resolving to the bucket IP address and allowed by the server certificate. - public string Fqdn { get; set; } - /// Certificate Common Name taken from the certificate installed on the bucket server. - public string CertificateCommonName { get; } - /// The bucket server's certificate expiry date. - public DateTimeOffset? CertificateExpiryOn { get; } - /// The bucket server's IPv4 address. - public string IPAddress { get; } - /// A base64-encoded PEM file, which includes both the bucket server's certificate and private key. It is used to authenticate the user and allows access to volume data in a read-only manner. - public string CertificateObject { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChangeKeyVault.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChangeKeyVault.Serialization.cs deleted file mode 100644 index 4ff05221afe5..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChangeKeyVault.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppChangeKeyVault : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppChangeKeyVault)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("keyVaultUri"u8); - writer.WriteStringValue(KeyVaultUri.AbsoluteUri); - writer.WritePropertyName("keyName"u8); - writer.WriteStringValue(KeyName); - if (Optional.IsDefined(KeyVaultResourceId)) - { - writer.WritePropertyName("keyVaultResourceId"u8); - writer.WriteStringValue(KeyVaultResourceId); - } - writer.WritePropertyName("keyVaultPrivateEndpoints"u8); - writer.WriteStartArray(); - foreach (var item in KeyVaultPrivateEndpoints) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppChangeKeyVault IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppChangeKeyVault)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppChangeKeyVault(document.RootElement, options); - } - - internal static NetAppChangeKeyVault DeserializeNetAppChangeKeyVault(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Uri keyVaultUri = default; - string keyName = default; - ResourceIdentifier keyVaultResourceId = default; - IList keyVaultPrivateEndpoints = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("keyVaultUri"u8)) - { - keyVaultUri = new Uri(property.Value.GetString()); - continue; - } - if (property.NameEquals("keyName"u8)) - { - keyName = property.Value.GetString(); - continue; - } - if (property.NameEquals("keyVaultResourceId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultResourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("keyVaultPrivateEndpoints"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(NetAppKeyVaultPrivateEndpoint.DeserializeNetAppKeyVaultPrivateEndpoint(item, options)); - } - keyVaultPrivateEndpoints = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppChangeKeyVault(keyVaultUri, keyName, keyVaultResourceId, keyVaultPrivateEndpoints, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppChangeKeyVault)} does not support writing '{options.Format}' format."); - } - } - - NetAppChangeKeyVault IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppChangeKeyVault(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppChangeKeyVault)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppCheckAvailabilityResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppCheckAvailabilityResult.Serialization.cs deleted file mode 100644 index 875a568cb8c0..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppCheckAvailabilityResult.Serialization.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppCheckAvailabilityResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppCheckAvailabilityResult)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsAvailable)) - { - writer.WritePropertyName("isAvailable"u8); - writer.WriteBooleanValue(IsAvailable.Value); - } - if (Optional.IsDefined(Reason)) - { - writer.WritePropertyName("reason"u8); - writer.WriteStringValue(Reason.Value.ToString()); - } - if (Optional.IsDefined(Message)) - { - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppCheckAvailabilityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppCheckAvailabilityResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppCheckAvailabilityResult(document.RootElement, options); - } - - internal static NetAppCheckAvailabilityResult DeserializeNetAppCheckAvailabilityResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? isAvailable = default; - NetAppNameUnavailableReason? reason = default; - string message = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("isAvailable"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isAvailable = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("reason"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - reason = new NetAppNameUnavailableReason(property.Value.GetString()); - continue; - } - if (property.NameEquals("message"u8)) - { - message = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppCheckAvailabilityResult(isAvailable, reason, message, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppCheckAvailabilityResult)} does not support writing '{options.Format}' format."); - } - } - - NetAppCheckAvailabilityResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppCheckAvailabilityResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppCheckAvailabilityResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChownMode.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChownMode.cs deleted file mode 100644 index b55f26f7902a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppChownMode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root users can change ownership of files that they own. - public readonly partial struct NetAppChownMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppChownMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string RestrictedValue = "Restricted"; - private const string UnrestrictedValue = "Unrestricted"; - - /// Restricted. - public static NetAppChownMode Restricted { get; } = new NetAppChownMode(RestrictedValue); - /// Unrestricted. - public static NetAppChownMode Unrestricted { get; } = new NetAppChownMode(UnrestrictedValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppChownMode left, NetAppChownMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppChownMode left, NetAppChownMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppChownMode(string value) => new NetAppChownMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppChownMode other && Equals(other); - /// - public bool Equals(NetAppChownMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppDestinationReplication.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppDestinationReplication.Serialization.cs deleted file mode 100644 index 46cc35e510d1..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppDestinationReplication.Serialization.cs +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppDestinationReplication : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppDestinationReplication)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceId)) - { - writer.WritePropertyName("resourceId"u8); - writer.WriteStringValue(ResourceId); - } - if (Optional.IsDefined(ReplicationType)) - { - writer.WritePropertyName("replicationType"u8); - writer.WriteStringValue(ReplicationType.Value.ToString()); - } - if (Optional.IsDefined(Region)) - { - writer.WritePropertyName("region"u8); - writer.WriteStringValue(Region); - } - if (Optional.IsDefined(Zone)) - { - writer.WritePropertyName("zone"u8); - writer.WriteStringValue(Zone); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppDestinationReplication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppDestinationReplication)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppDestinationReplication(document.RootElement, options); - } - - internal static NetAppDestinationReplication DeserializeNetAppDestinationReplication(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier resourceId = default; - NetAppReplicationType? replicationType = default; - string region = default; - string zone = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("replicationType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - replicationType = new NetAppReplicationType(property.Value.GetString()); - continue; - } - if (property.NameEquals("region"u8)) - { - region = property.Value.GetString(); - continue; - } - if (property.NameEquals("zone"u8)) - { - zone = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppDestinationReplication(resourceId, replicationType, region, zone, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppDestinationReplication)} does not support writing '{options.Format}' format."); - } - } - - NetAppDestinationReplication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppDestinationReplication(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppDestinationReplication)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppDestinationReplication.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppDestinationReplication.cs deleted file mode 100644 index 3f011d4a4fce..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppDestinationReplication.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Destination replication properties. - public partial class NetAppDestinationReplication - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppDestinationReplication() - { - } - - /// Initializes a new instance of . - /// The resource ID of the remote volume. - /// Indicates whether the replication is cross zone or cross region. - /// The remote region for the destination volume. - /// The remote zone for the destination volume. - /// Keeps track of any properties unknown to the library. - internal NetAppDestinationReplication(ResourceIdentifier resourceId, NetAppReplicationType? replicationType, string region, string zone, IDictionary serializedAdditionalRawData) - { - ResourceId = resourceId; - ReplicationType = replicationType; - Region = region; - Zone = zone; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The resource ID of the remote volume. - public ResourceIdentifier ResourceId { get; } - /// Indicates whether the replication is cross zone or cross region. - public NetAppReplicationType? ReplicationType { get; } - /// The remote region for the destination volume. - public string Region { get; } - /// The remote zone for the destination volume. - public string Zone { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionIdentity.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionIdentity.Serialization.cs deleted file mode 100644 index 5828d31ed4c0..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionIdentity.Serialization.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppEncryptionIdentity : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppEncryptionIdentity)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsDefined(PrincipalId)) - { - writer.WritePropertyName("principalId"u8); - writer.WriteStringValue(PrincipalId); - } - if (Optional.IsDefined(UserAssignedIdentity)) - { - writer.WritePropertyName("userAssignedIdentity"u8); - writer.WriteStringValue(UserAssignedIdentity); - } - if (Optional.IsDefined(FederatedClientId)) - { - writer.WritePropertyName("federatedClientId"u8); - writer.WriteStringValue(FederatedClientId); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppEncryptionIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppEncryptionIdentity)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppEncryptionIdentity(document.RootElement, options); - } - - internal static NetAppEncryptionIdentity DeserializeNetAppEncryptionIdentity(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string principalId = default; - string userAssignedIdentity = default; - string federatedClientId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("principalId"u8)) - { - principalId = property.Value.GetString(); - continue; - } - if (property.NameEquals("userAssignedIdentity"u8)) - { - userAssignedIdentity = property.Value.GetString(); - continue; - } - if (property.NameEquals("federatedClientId"u8)) - { - federatedClientId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppEncryptionIdentity(principalId, userAssignedIdentity, federatedClientId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppEncryptionIdentity)} does not support writing '{options.Format}' format."); - } - } - - NetAppEncryptionIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppEncryptionIdentity(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppEncryptionIdentity)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionIdentity.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionIdentity.cs deleted file mode 100644 index 40984f9d9a7b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionIdentity.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Identity used to authenticate with key vault. - public partial class NetAppEncryptionIdentity - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppEncryptionIdentity() - { - } - - /// Initializes a new instance of . - /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. - /// The ARM resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. - /// ClientId of the multi-tenant AAD Application. Used to access cross-tenant KeyVaults. - /// Keeps track of any properties unknown to the library. - internal NetAppEncryptionIdentity(string principalId, string userAssignedIdentity, string federatedClientId, IDictionary serializedAdditionalRawData) - { - PrincipalId = principalId; - UserAssignedIdentity = userAssignedIdentity; - FederatedClientId = federatedClientId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. - public string PrincipalId { get; } - /// The ARM resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. - public string UserAssignedIdentity { get; set; } - /// ClientId of the multi-tenant AAD Application. Used to access cross-tenant KeyVaults. - public string FederatedClientId { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionKeySource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionKeySource.cs deleted file mode 100644 index d92194bc74b4..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionKeySource.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - public readonly partial struct NetAppEncryptionKeySource : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppEncryptionKeySource(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MicrosoftNetAppValue = "Microsoft.NetApp"; - private const string MicrosoftKeyVaultValue = "Microsoft.KeyVault"; - - /// Microsoft-managed key encryption. - public static NetAppEncryptionKeySource MicrosoftNetApp { get; } = new NetAppEncryptionKeySource(MicrosoftNetAppValue); - /// Customer-managed key encryption. - public static NetAppEncryptionKeySource MicrosoftKeyVault { get; } = new NetAppEncryptionKeySource(MicrosoftKeyVaultValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppEncryptionKeySource left, NetAppEncryptionKeySource right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppEncryptionKeySource left, NetAppEncryptionKeySource right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppEncryptionKeySource(string value) => new NetAppEncryptionKeySource(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppEncryptionKeySource other && Equals(other); - /// - public bool Equals(NetAppEncryptionKeySource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionTransitionContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionTransitionContent.Serialization.cs deleted file mode 100644 index 237d2c9ec5db..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionTransitionContent.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppEncryptionTransitionContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppEncryptionTransitionContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("virtualNetworkId"u8); - writer.WriteStringValue(VirtualNetworkId); - writer.WritePropertyName("privateEndpointId"u8); - writer.WriteStringValue(PrivateEndpointId); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppEncryptionTransitionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppEncryptionTransitionContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppEncryptionTransitionContent(document.RootElement, options); - } - - internal static NetAppEncryptionTransitionContent DeserializeNetAppEncryptionTransitionContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier virtualNetworkId = default; - ResourceIdentifier privateEndpointId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("virtualNetworkId"u8)) - { - virtualNetworkId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("privateEndpointId"u8)) - { - privateEndpointId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppEncryptionTransitionContent(virtualNetworkId, privateEndpointId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppEncryptionTransitionContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppEncryptionTransitionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppEncryptionTransitionContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppEncryptionTransitionContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionTransitionContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionTransitionContent.cs deleted file mode 100644 index d2dd283f2806..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEncryptionTransitionContent.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Encryption transition request. - public partial class NetAppEncryptionTransitionContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Identifier for the virtual network. - /// Identifier of the private endpoint to reach the Azure Key Vault. - /// or is null. - public NetAppEncryptionTransitionContent(ResourceIdentifier virtualNetworkId, ResourceIdentifier privateEndpointId) - { - Argument.AssertNotNull(virtualNetworkId, nameof(virtualNetworkId)); - Argument.AssertNotNull(privateEndpointId, nameof(privateEndpointId)); - - VirtualNetworkId = virtualNetworkId; - PrivateEndpointId = privateEndpointId; - } - - /// Initializes a new instance of . - /// Identifier for the virtual network. - /// Identifier of the private endpoint to reach the Azure Key Vault. - /// Keeps track of any properties unknown to the library. - internal NetAppEncryptionTransitionContent(ResourceIdentifier virtualNetworkId, ResourceIdentifier privateEndpointId, IDictionary serializedAdditionalRawData) - { - VirtualNetworkId = virtualNetworkId; - PrivateEndpointId = privateEndpointId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppEncryptionTransitionContent() - { - } - - /// Identifier for the virtual network. - public ResourceIdentifier VirtualNetworkId { get; } - /// Identifier of the private endpoint to reach the Azure Key Vault. - public ResourceIdentifier PrivateEndpointId { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEndpointType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEndpointType.cs index b6288a94dd57..37d73c919a42 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEndpointType.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppEndpointType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct NetAppEndpointType : IEquatable { private readonly string _value; + private const string SrcValue = "src"; + private const string DstValue = "dst"; /// Initializes a new instance of . + /// The value. /// is null. public NetAppEndpointType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); + Argument.AssertNotNull(value, nameof(value)); + + _value = value; } - private const string SourceValue = "src"; - private const string DestinationValue = "dst"; + /// Gets the Src. + public static NetAppEndpointType Src { get; } = new NetAppEndpointType(SrcValue); + + /// Gets the Dst. + public static NetAppEndpointType Dst { get; } = new NetAppEndpointType(DstValue); - /// src. - public static NetAppEndpointType Source { get; } = new NetAppEndpointType(SourceValue); - /// dst. - public static NetAppEndpointType Destination { get; } = new NetAppEndpointType(DestinationValue); /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(NetAppEndpointType left, NetAppEndpointType right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(NetAppEndpointType left, NetAppEndpointType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator NetAppEndpointType(string value) => new NetAppEndpointType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator NetAppEndpointType?(string value) => value == null ? null : new NetAppEndpointType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is NetAppEndpointType other && Equals(other); - /// + + /// public bool Equals(NetAppEndpointType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFileAccessLog.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFileAccessLog.cs deleted file mode 100644 index f30febad8cb1..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFileAccessLog.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - public readonly partial struct NetAppFileAccessLog : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppFileAccessLog(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// fileAccessLogs are enabled. - public static NetAppFileAccessLog Enabled { get; } = new NetAppFileAccessLog(EnabledValue); - /// fileAccessLogs are not enabled. - public static NetAppFileAccessLog Disabled { get; } = new NetAppFileAccessLog(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppFileAccessLog left, NetAppFileAccessLog right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppFileAccessLog left, NetAppFileAccessLog right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppFileAccessLog(string value) => new NetAppFileAccessLog(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppFileAccessLog other && Equals(other); - /// - public bool Equals(NetAppFileAccessLog other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFilePathAvailabilityContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFilePathAvailabilityContent.Serialization.cs deleted file mode 100644 index 71ada2e347fc..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFilePathAvailabilityContent.Serialization.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppFilePathAvailabilityContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppFilePathAvailabilityContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("subnetId"u8); - writer.WriteStringValue(SubnetId); - if (Optional.IsDefined(AvailabilityZone)) - { - if (AvailabilityZone != null) - { - writer.WritePropertyName("availabilityZone"u8); - writer.WriteStringValue(AvailabilityZone); - } - else - { - writer.WriteNull("availabilityZone"); - } - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppFilePathAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppFilePathAvailabilityContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppFilePathAvailabilityContent(document.RootElement, options); - } - - internal static NetAppFilePathAvailabilityContent DeserializeNetAppFilePathAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - ResourceIdentifier subnetId = default; - string availabilityZone = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("subnetId"u8)) - { - subnetId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("availabilityZone"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - availabilityZone = null; - continue; - } - availabilityZone = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppFilePathAvailabilityContent(name, subnetId, availabilityZone, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppFilePathAvailabilityContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppFilePathAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppFilePathAvailabilityContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppFilePathAvailabilityContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFilePathAvailabilityContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFilePathAvailabilityContent.cs deleted file mode 100644 index 049048b3767e..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFilePathAvailabilityContent.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// File path availability request content - availability is based on the name and the subnetId. - public partial class NetAppFilePathAvailabilityContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// File path to verify. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// or is null. - public NetAppFilePathAvailabilityContent(string name, ResourceIdentifier subnetId) - { - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(subnetId, nameof(subnetId)); - - Name = name; - SubnetId = subnetId; - } - - /// Initializes a new instance of . - /// File path to verify. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// The Azure Resource logical availability zone which is used within zone mapping lookup for the subscription and region. The lookup will retrieve the physical zone where volume is placed. - /// Keeps track of any properties unknown to the library. - internal NetAppFilePathAvailabilityContent(string name, ResourceIdentifier subnetId, string availabilityZone, IDictionary serializedAdditionalRawData) - { - Name = name; - SubnetId = subnetId; - AvailabilityZone = availabilityZone; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppFilePathAvailabilityContent() - { - } - - /// File path to verify. - public string Name { get; } - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - public ResourceIdentifier SubnetId { get; } - /// The Azure Resource logical availability zone which is used within zone mapping lookup for the subscription and region. The lookup will retrieve the physical zone where volume is placed. - public string AvailabilityZone { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFileServiceLevel.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFileServiceLevel.cs index 9b8cec9c1600..18935d5628c8 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFileServiceLevel.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppFileServiceLevel.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,47 +15,72 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct NetAppFileServiceLevel : IEquatable { private readonly string _value; + /// Standard service level. + private const string StandardValue = "Standard"; + /// Premium service level. + private const string PremiumValue = "Premium"; + /// Ultra service level. + private const string UltraValue = "Ultra"; + /// Zone redundant storage service level. This will be deprecated soon. + private const string StandardZRSValue = "StandardZRS"; + /// Flexible service level. + private const string FlexibleValue = "Flexible"; /// Initializes a new instance of . + /// The value. /// is null. public NetAppFileServiceLevel(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string StandardValue = "Standard"; - private const string PremiumValue = "Premium"; - private const string UltraValue = "Ultra"; - private const string StandardZrsValue = "StandardZRS"; - private const string FlexibleValue = "Flexible"; + _value = value; + } /// Standard service level. public static NetAppFileServiceLevel Standard { get; } = new NetAppFileServiceLevel(StandardValue); + /// Premium service level. public static NetAppFileServiceLevel Premium { get; } = new NetAppFileServiceLevel(PremiumValue); + /// Ultra service level. public static NetAppFileServiceLevel Ultra { get; } = new NetAppFileServiceLevel(UltraValue); + /// Zone redundant storage service level. This will be deprecated soon. - public static NetAppFileServiceLevel StandardZrs { get; } = new NetAppFileServiceLevel(StandardZrsValue); + public static NetAppFileServiceLevel StandardZRS { get; } = new NetAppFileServiceLevel(StandardZRSValue); + /// Flexible service level. public static NetAppFileServiceLevel Flexible { get; } = new NetAppFileServiceLevel(FlexibleValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(NetAppFileServiceLevel left, NetAppFileServiceLevel right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(NetAppFileServiceLevel left, NetAppFileServiceLevel right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator NetAppFileServiceLevel(string value) => new NetAppFileServiceLevel(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator NetAppFileServiceLevel?(string value) => value == null ? null : new NetAppFileServiceLevel(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is NetAppFileServiceLevel other && Equals(other); - /// + + /// public bool Equals(NetAppFileServiceLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeySource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeySource.cs deleted file mode 100644 index 9682041ae757..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeySource.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// The encryption keySource (provider). Possible values (case-insensitive): Microsoft.NetApp, Microsoft.KeyVault. - public readonly partial struct NetAppKeySource : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppKeySource(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MicrosoftNetAppValue = "Microsoft.NetApp"; - private const string MicrosoftKeyVaultValue = "Microsoft.KeyVault"; - - /// Microsoft-managed key encryption. - public static NetAppKeySource MicrosoftNetApp { get; } = new NetAppKeySource(MicrosoftNetAppValue); - /// Customer-managed key encryption. - public static NetAppKeySource MicrosoftKeyVault { get; } = new NetAppKeySource(MicrosoftKeyVaultValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppKeySource left, NetAppKeySource right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppKeySource left, NetAppKeySource right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppKeySource(string value) => new NetAppKeySource(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppKeySource other && Equals(other); - /// - public bool Equals(NetAppKeySource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultPrivateEndpoint.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultPrivateEndpoint.Serialization.cs deleted file mode 100644 index f120e5db6a17..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultPrivateEndpoint.Serialization.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppKeyVaultPrivateEndpoint : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppKeyVaultPrivateEndpoint)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(VirtualNetworkId)) - { - writer.WritePropertyName("virtualNetworkId"u8); - writer.WriteStringValue(VirtualNetworkId); - } - if (Optional.IsDefined(PrivateEndpointId)) - { - writer.WritePropertyName("privateEndpointId"u8); - writer.WriteStringValue(PrivateEndpointId); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppKeyVaultPrivateEndpoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppKeyVaultPrivateEndpoint)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppKeyVaultPrivateEndpoint(document.RootElement, options); - } - - internal static NetAppKeyVaultPrivateEndpoint DeserializeNetAppKeyVaultPrivateEndpoint(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier virtualNetworkId = default; - ResourceIdentifier privateEndpointId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("virtualNetworkId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - virtualNetworkId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("privateEndpointId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateEndpointId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppKeyVaultPrivateEndpoint(virtualNetworkId, privateEndpointId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppKeyVaultPrivateEndpoint)} does not support writing '{options.Format}' format."); - } - } - - NetAppKeyVaultPrivateEndpoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppKeyVaultPrivateEndpoint(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppKeyVaultPrivateEndpoint)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultPrivateEndpoint.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultPrivateEndpoint.cs deleted file mode 100644 index 5353f22857c5..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultPrivateEndpoint.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. - public partial class NetAppKeyVaultPrivateEndpoint - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppKeyVaultPrivateEndpoint() - { - } - - /// Initializes a new instance of . - /// Identifier for the virtual network id. - /// Identifier of the private endpoint to reach the Azure Key Vault. - /// Keeps track of any properties unknown to the library. - internal NetAppKeyVaultPrivateEndpoint(ResourceIdentifier virtualNetworkId, ResourceIdentifier privateEndpointId, IDictionary serializedAdditionalRawData) - { - VirtualNetworkId = virtualNetworkId; - PrivateEndpointId = privateEndpointId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Identifier for the virtual network id. - public ResourceIdentifier VirtualNetworkId { get; set; } - /// Identifier of the private endpoint to reach the Azure Key Vault. - public ResourceIdentifier PrivateEndpointId { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultProperties.Serialization.cs deleted file mode 100644 index 45bc245cafee..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultProperties.Serialization.cs +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppKeyVaultProperties : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppKeyVaultProperties)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsDefined(KeyVaultId)) - { - writer.WritePropertyName("keyVaultId"u8); - writer.WriteStringValue(KeyVaultId); - } - writer.WritePropertyName("keyVaultUri"u8); - writer.WriteStringValue(KeyVaultUri.AbsoluteUri); - writer.WritePropertyName("keyName"u8); - writer.WriteStringValue(KeyName); - if (Optional.IsDefined(KeyVaultArmResourceId)) - { - writer.WritePropertyName("keyVaultResourceId"u8); - writer.WriteStringValue(KeyVaultArmResourceId); - } - if (options.Format != "W" && Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppKeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppKeyVaultProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppKeyVaultProperties(document.RootElement, options); - } - - internal static NetAppKeyVaultProperties DeserializeNetAppKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string keyVaultId = default; - Uri keyVaultUri = default; - string keyName = default; - ResourceIdentifier keyVaultResourceId = default; - NetAppKeyVaultStatus? status = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("keyVaultId"u8)) - { - keyVaultId = property.Value.GetString(); - continue; - } - if (property.NameEquals("keyVaultUri"u8)) - { - keyVaultUri = new Uri(property.Value.GetString()); - continue; - } - if (property.NameEquals("keyName"u8)) - { - keyName = property.Value.GetString(); - continue; - } - if (property.NameEquals("keyVaultResourceId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultResourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("status"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new NetAppKeyVaultStatus(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppKeyVaultProperties( - keyVaultId, - keyVaultUri, - keyName, - keyVaultResourceId, - status, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppKeyVaultProperties)} does not support writing '{options.Format}' format."); - } - } - - NetAppKeyVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppKeyVaultProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppKeyVaultProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultProperties.cs deleted file mode 100644 index 2c06281f5cc8..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultProperties.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Properties of key vault. - public partial class NetAppKeyVaultProperties - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The Uri of KeyVault. - /// The name of KeyVault key. - /// or is null. - public NetAppKeyVaultProperties(Uri keyVaultUri, string keyName) - { - Argument.AssertNotNull(keyVaultUri, nameof(keyVaultUri)); - Argument.AssertNotNull(keyName, nameof(keyName)); - - KeyVaultUri = keyVaultUri; - KeyName = keyName; - } - - /// Initializes a new instance of . - /// UUID v4 used to identify the Azure Key Vault configuration. - /// The Uri of KeyVault. - /// The name of KeyVault key. - /// The resource ID of KeyVault. - /// Status of the KeyVault connection. - /// Keeps track of any properties unknown to the library. - internal NetAppKeyVaultProperties(string keyVaultId, Uri keyVaultUri, string keyName, ResourceIdentifier keyVaultArmResourceId, NetAppKeyVaultStatus? status, IDictionary serializedAdditionalRawData) - { - KeyVaultId = keyVaultId; - KeyVaultUri = keyVaultUri; - KeyName = keyName; - KeyVaultArmResourceId = keyVaultArmResourceId; - Status = status; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppKeyVaultProperties() - { - } - - /// UUID v4 used to identify the Azure Key Vault configuration. - public string KeyVaultId { get; } - /// The Uri of KeyVault. - public Uri KeyVaultUri { get; set; } - /// The name of KeyVault key. - public string KeyName { get; set; } - /// The resource ID of KeyVault. - public ResourceIdentifier KeyVaultArmResourceId { get; set; } - /// Status of the KeyVault connection. - public NetAppKeyVaultStatus? Status { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatus.cs index 829facaedafd..61efad154628 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatus.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,47 +15,72 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct NetAppKeyVaultStatus : IEquatable { private readonly string _value; + /// KeyVault connection created but not in use. + private const string CreatedValue = "Created"; + /// KeyVault connection in use by SMB Volume. + private const string InUseValue = "InUse"; + /// KeyVault connection Deleted. + private const string DeletedValue = "Deleted"; + /// Error with the KeyVault connection. + private const string ErrorValue = "Error"; + /// KeyVault connection Updating. + private const string UpdatingValue = "Updating"; /// Initializes a new instance of . + /// The value. /// is null. public NetAppKeyVaultStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string CreatedValue = "Created"; - private const string InUseValue = "InUse"; - private const string DeletedValue = "Deleted"; - private const string ErrorValue = "Error"; - private const string UpdatingValue = "Updating"; + _value = value; + } /// KeyVault connection created but not in use. public static NetAppKeyVaultStatus Created { get; } = new NetAppKeyVaultStatus(CreatedValue); + /// KeyVault connection in use by SMB Volume. public static NetAppKeyVaultStatus InUse { get; } = new NetAppKeyVaultStatus(InUseValue); + /// KeyVault connection Deleted. public static NetAppKeyVaultStatus Deleted { get; } = new NetAppKeyVaultStatus(DeletedValue); + /// Error with the KeyVault connection. public static NetAppKeyVaultStatus Error { get; } = new NetAppKeyVaultStatus(ErrorValue); + /// KeyVault connection Updating. public static NetAppKeyVaultStatus Updating { get; } = new NetAppKeyVaultStatus(UpdatingValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(NetAppKeyVaultStatus left, NetAppKeyVaultStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(NetAppKeyVaultStatus left, NetAppKeyVaultStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator NetAppKeyVaultStatus(string value) => new NetAppKeyVaultStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator NetAppKeyVaultStatus?(string value) => value == null ? null : new NetAppKeyVaultStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is NetAppKeyVaultStatus other && Equals(other); - /// + + /// public bool Equals(NetAppKeyVaultStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatusResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatusResult.Serialization.cs deleted file mode 100644 index fee5268b3cb2..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatusResult.Serialization.cs +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppKeyVaultStatusResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppKeyVaultStatusResult)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(KeyVaultUri)) - { - writer.WritePropertyName("keyVaultUri"u8); - writer.WriteStringValue(KeyVaultUri.AbsoluteUri); - } - if (Optional.IsDefined(KeyName)) - { - writer.WritePropertyName("keyName"u8); - writer.WriteStringValue(KeyName); - } - if (Optional.IsDefined(KeyVaultResourceId)) - { - writer.WritePropertyName("keyVaultResourceId"u8); - writer.WriteStringValue(KeyVaultResourceId); - } - if (Optional.IsCollectionDefined(KeyVaultPrivateEndpoints)) - { - writer.WritePropertyName("keyVaultPrivateEndpoints"u8); - writer.WriteStartArray(); - foreach (var item in KeyVaultPrivateEndpoints) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppKeyVaultStatusResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppKeyVaultStatusResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppKeyVaultStatusResult(document.RootElement, options); - } - - internal static NetAppKeyVaultStatusResult DeserializeNetAppKeyVaultStatusResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Uri keyVaultUri = default; - string keyName = default; - ResourceIdentifier keyVaultResourceId = default; - IReadOnlyList keyVaultPrivateEndpoints = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("keyVaultUri"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultUri = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("keyName"u8)) - { - keyName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("keyVaultResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultResourceId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("keyVaultPrivateEndpoints"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(NetAppKeyVaultPrivateEndpoint.DeserializeNetAppKeyVaultPrivateEndpoint(item, options)); - } - keyVaultPrivateEndpoints = array; - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppKeyVaultStatusResult(keyVaultUri, keyName, keyVaultResourceId, keyVaultPrivateEndpoints ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppKeyVaultStatusResult)} does not support writing '{options.Format}' format."); - } - } - - NetAppKeyVaultStatusResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppKeyVaultStatusResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppKeyVaultStatusResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatusResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatusResult.cs deleted file mode 100644 index a3b9ebae64eb..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppKeyVaultStatusResult.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Result of getKeyVaultStatus with information about how volumes under NetApp account are encrypted. - public partial class NetAppKeyVaultStatusResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppKeyVaultStatusResult() - { - KeyVaultPrivateEndpoints = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The URI of the key vault/managed HSM that should be used for encryption. - /// The name of the key that should be used for encryption. - /// Azure resource ID of the key vault/managed HSM that should be used for encryption. - /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. - /// Keeps track of any properties unknown to the library. - internal NetAppKeyVaultStatusResult(Uri keyVaultUri, string keyName, ResourceIdentifier keyVaultResourceId, IReadOnlyList keyVaultPrivateEndpoints, IDictionary serializedAdditionalRawData) - { - KeyVaultUri = keyVaultUri; - KeyName = keyName; - KeyVaultResourceId = keyVaultResourceId; - KeyVaultPrivateEndpoints = keyVaultPrivateEndpoints; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The URI of the key vault/managed HSM that should be used for encryption. - public Uri KeyVaultUri { get; } - /// The name of the key that should be used for encryption. - public string KeyName { get; } - /// Azure resource ID of the key vault/managed HSM that should be used for encryption. - public ResourceIdentifier KeyVaultResourceId { get; } - /// Pairs of virtual network ID and private endpoint ID. Every virtual network that has volumes encrypted with customer-managed keys needs its own key vault private endpoint. - public IReadOnlyList KeyVaultPrivateEndpoints { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppLdapSearchScopeConfiguration.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppLdapSearchScopeConfiguration.Serialization.cs deleted file mode 100644 index d1ff3acdb75b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppLdapSearchScopeConfiguration.Serialization.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppLdapSearchScopeConfiguration : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppLdapSearchScopeConfiguration)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(UserDN)) - { - writer.WritePropertyName("userDN"u8); - writer.WriteStringValue(UserDN); - } - if (Optional.IsDefined(GroupDN)) - { - writer.WritePropertyName("groupDN"u8); - writer.WriteStringValue(GroupDN); - } - if (Optional.IsDefined(GroupMembershipFilter)) - { - writer.WritePropertyName("groupMembershipFilter"u8); - writer.WriteStringValue(GroupMembershipFilter); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppLdapSearchScopeConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppLdapSearchScopeConfiguration)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppLdapSearchScopeConfiguration(document.RootElement, options); - } - - internal static NetAppLdapSearchScopeConfiguration DeserializeNetAppLdapSearchScopeConfiguration(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string userDN = default; - string groupDN = default; - string groupMembershipFilter = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("userDN"u8)) - { - userDN = property.Value.GetString(); - continue; - } - if (property.NameEquals("groupDN"u8)) - { - groupDN = property.Value.GetString(); - continue; - } - if (property.NameEquals("groupMembershipFilter"u8)) - { - groupMembershipFilter = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppLdapSearchScopeConfiguration(userDN, groupDN, groupMembershipFilter, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppLdapSearchScopeConfiguration)} does not support writing '{options.Format}' format."); - } - } - - NetAppLdapSearchScopeConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppLdapSearchScopeConfiguration(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppLdapSearchScopeConfiguration)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppLdapSearchScopeConfiguration.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppLdapSearchScopeConfiguration.cs deleted file mode 100644 index 9a84531d7c83..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppLdapSearchScopeConfiguration.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// LDAP search scope. - public partial class NetAppLdapSearchScopeConfiguration - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppLdapSearchScopeConfiguration() - { - } - - /// Initializes a new instance of . - /// This specifies the user DN, which overrides the base DN for user lookups. - /// This specifies the group DN, which overrides the base DN for group lookups. - /// This specifies the custom LDAP search filter to be used when looking up group membership from LDAP server. - /// Keeps track of any properties unknown to the library. - internal NetAppLdapSearchScopeConfiguration(string userDN, string groupDN, string groupMembershipFilter, IDictionary serializedAdditionalRawData) - { - UserDN = userDN; - GroupDN = groupDN; - GroupMembershipFilter = groupMembershipFilter; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// This specifies the user DN, which overrides the base DN for user lookups. - public string UserDN { get; set; } - /// This specifies the group DN, which overrides the base DN for group lookups. - public string GroupDN { get; set; } - /// This specifies the custom LDAP search filter to be used when looking up group membership from LDAP server. - public string GroupMembershipFilter { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppMirrorState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppMirrorState.cs index ba11c919069f..6584c75536fd 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppMirrorState.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppMirrorState.cs @@ -7,48 +7,67 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - /// The mirror state property describes the current status of data replication for a resource. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. + /// The status of the replication. public readonly partial struct NetAppMirrorState : IEquatable { private readonly string _value; + private const string UninitializedValue = "Uninitialized"; + private const string MirroredValue = "Mirrored"; + private const string BrokenValue = "Broken"; /// Initializes a new instance of . + /// The value. /// is null. public NetAppMirrorState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string UninitializedValue = "Uninitialized"; - private const string MirroredValue = "Mirrored"; - private const string BrokenValue = "Broken"; + _value = value; + } - /// The mirror state is still uninitialized. + /// Gets the Uninitialized. public static NetAppMirrorState Uninitialized { get; } = new NetAppMirrorState(UninitializedValue); - /// The mirror state is mirrored. + + /// Gets the Mirrored. public static NetAppMirrorState Mirrored { get; } = new NetAppMirrorState(MirroredValue); - /// The mirror state is broken. + + /// Gets the Broken. public static NetAppMirrorState Broken { get; } = new NetAppMirrorState(BrokenValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(NetAppMirrorState left, NetAppMirrorState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(NetAppMirrorState left, NetAppMirrorState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator NetAppMirrorState(string value) => new NetAppMirrorState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator NetAppMirrorState?(string value) => value == null ? null : new NetAppMirrorState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is NetAppMirrorState other && Equals(other); - /// + + /// public bool Equals(NetAppMirrorState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityContent.Serialization.cs deleted file mode 100644 index d6fca550ccba..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityContent.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppNameAvailabilityContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppNameAvailabilityContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType.ToString()); - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppNameAvailabilityContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppNameAvailabilityContent(document.RootElement, options); - } - - internal static NetAppNameAvailabilityContent DeserializeNetAppNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - NetAppNameAvailabilityResourceType type = default; - string resourceGroup = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new NetAppNameAvailabilityResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppNameAvailabilityContent(name, type, resourceGroup, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppNameAvailabilityContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppNameAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppNameAvailabilityContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppNameAvailabilityContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityContent.cs deleted file mode 100644 index 4ca775999808..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityContent.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Resource name availability request content. - public partial class NetAppNameAvailabilityContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Resource name to verify. - /// Resource type used for verification. - /// Resource group name. - /// or is null. - public NetAppNameAvailabilityContent(string name, NetAppNameAvailabilityResourceType resourceType, string resourceGroup) - { - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(resourceGroup, nameof(resourceGroup)); - - Name = name; - ResourceType = resourceType; - ResourceGroup = resourceGroup; - } - - /// Initializes a new instance of . - /// Resource name to verify. - /// Resource type used for verification. - /// Resource group name. - /// Keeps track of any properties unknown to the library. - internal NetAppNameAvailabilityContent(string name, NetAppNameAvailabilityResourceType resourceType, string resourceGroup, IDictionary serializedAdditionalRawData) - { - Name = name; - ResourceType = resourceType; - ResourceGroup = resourceGroup; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppNameAvailabilityContent() - { - } - - /// Resource name to verify. - public string Name { get; } - /// Resource type used for verification. - public NetAppNameAvailabilityResourceType ResourceType { get; } - /// Resource group name. - public string ResourceGroup { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityResourceType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityResourceType.cs deleted file mode 100644 index 4cef6a197d3b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameAvailabilityResourceType.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Resource type used for verification. - public readonly partial struct NetAppNameAvailabilityResourceType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppNameAvailabilityResourceType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MicrosoftNetAppNetAppAccountsValue = "Microsoft.NetApp/netAppAccounts"; - private const string MicrosoftNetAppNetAppAccountsCapacityPoolsValue = "Microsoft.NetApp/netAppAccounts/capacityPools"; - private const string MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesValue = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes"; - private const string MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshotsValue = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots"; - - /// Microsoft.NetApp/netAppAccounts. - public static NetAppNameAvailabilityResourceType MicrosoftNetAppNetAppAccounts { get; } = new NetAppNameAvailabilityResourceType(MicrosoftNetAppNetAppAccountsValue); - /// Microsoft.NetApp/netAppAccounts/capacityPools. - public static NetAppNameAvailabilityResourceType MicrosoftNetAppNetAppAccountsCapacityPools { get; } = new NetAppNameAvailabilityResourceType(MicrosoftNetAppNetAppAccountsCapacityPoolsValue); - /// Microsoft.NetApp/netAppAccounts/capacityPools/volumes. - public static NetAppNameAvailabilityResourceType MicrosoftNetAppNetAppAccountsCapacityPoolsVolumes { get; } = new NetAppNameAvailabilityResourceType(MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesValue); - /// Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots. - public static NetAppNameAvailabilityResourceType MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots { get; } = new NetAppNameAvailabilityResourceType(MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshotsValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppNameAvailabilityResourceType left, NetAppNameAvailabilityResourceType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppNameAvailabilityResourceType left, NetAppNameAvailabilityResourceType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppNameAvailabilityResourceType(string value) => new NetAppNameAvailabilityResourceType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppNameAvailabilityResourceType other && Equals(other); - /// - public bool Equals(NetAppNameAvailabilityResourceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameUnavailableReason.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameUnavailableReason.cs deleted file mode 100644 index 23b71e28c927..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNameUnavailableReason.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// <code>Invalid</code> indicates the name provided does not match Azure App Service naming requirements. <code>AlreadyExists</code> indicates that the name is already in use and is therefore unavailable. - public readonly partial struct NetAppNameUnavailableReason : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppNameUnavailableReason(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string InvalidValue = "Invalid"; - private const string AlreadyExistsValue = "AlreadyExists"; - - /// Invalid. - public static NetAppNameUnavailableReason Invalid { get; } = new NetAppNameUnavailableReason(InvalidValue); - /// AlreadyExists. - public static NetAppNameUnavailableReason AlreadyExists { get; } = new NetAppNameUnavailableReason(AlreadyExistsValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppNameUnavailableReason left, NetAppNameUnavailableReason right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppNameUnavailableReason left, NetAppNameUnavailableReason right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppNameUnavailableReason(string value) => new NetAppNameUnavailableReason(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppNameUnavailableReason other && Equals(other); - /// - public bool Equals(NetAppNameUnavailableReason other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNetworkFeature.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNetworkFeature.cs deleted file mode 100644 index bf5e443847f5..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppNetworkFeature.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Network features available to the volume, or current state of update. - public readonly partial struct NetAppNetworkFeature : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppNetworkFeature(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string BasicValue = "Basic"; - private const string StandardValue = "Standard"; - private const string BasicStandardValue = "Basic_Standard"; - private const string StandardBasicValue = "Standard_Basic"; - - /// Basic network features. - public static NetAppNetworkFeature Basic { get; } = new NetAppNetworkFeature(BasicValue); - /// Standard network features. - public static NetAppNetworkFeature Standard { get; } = new NetAppNetworkFeature(StandardValue); - /// Updating from Basic to Standard network features. - public static NetAppNetworkFeature BasicStandard { get; } = new NetAppNetworkFeature(BasicStandardValue); - /// Updating from Standard to Basic network features. - public static NetAppNetworkFeature StandardBasic { get; } = new NetAppNetworkFeature(StandardBasicValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppNetworkFeature left, NetAppNetworkFeature right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppNetworkFeature left, NetAppNetworkFeature right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppNetworkFeature(string value) => new NetAppNetworkFeature(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppNetworkFeature other && Equals(other); - /// - public bool Equals(NetAppNetworkFeature other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppProvisioningState.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppProvisioningState.Serialization.cs deleted file mode 100644 index bb201023f272..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppProvisioningState.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.NetApp.Models -{ - internal static partial class NetAppProvisioningStateExtensions - { - public static string ToSerialString(this NetAppProvisioningState value) => value switch - { - NetAppProvisioningState.Succeeded => "Succeeded", - NetAppProvisioningState.Failed => "Failed", - NetAppProvisioningState.Canceled => "Canceled", - NetAppProvisioningState.Provisioning => "Provisioning", - NetAppProvisioningState.Moving => "Moving", - NetAppProvisioningState.Updating => "Updating", - NetAppProvisioningState.Deleting => "Deleting", - NetAppProvisioningState.Accepted => "Accepted", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown NetAppProvisioningState value.") - }; - - public static NetAppProvisioningState ToNetAppProvisioningState(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Succeeded")) return NetAppProvisioningState.Succeeded; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Failed")) return NetAppProvisioningState.Failed; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Canceled")) return NetAppProvisioningState.Canceled; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Provisioning")) return NetAppProvisioningState.Provisioning; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Moving")) return NetAppProvisioningState.Moving; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Updating")) return NetAppProvisioningState.Updating; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Deleting")) return NetAppProvisioningState.Deleting; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Accepted")) return NetAppProvisioningState.Accepted; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown NetAppProvisioningState value."); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppProvisioningState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppProvisioningState.cs new file mode 100644 index 000000000000..f7b66da9cb45 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppProvisioningState.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Gets the status of the VolumeQuotaRule at the time the operation was called. + internal readonly partial struct NetAppProvisioningState : IEquatable + { + private readonly string _value; + /// Resource has been Accepted. + private const string AcceptedValue = "Accepted"; + /// Resource is being Created. + private const string CreatingValue = "Creating"; + /// Resource is being Patched. + private const string PatchingValue = "Patching"; + /// Resource is updating. + private const string UpdatingValue = "Updating"; + /// Resource is being Deleted. + private const string DeletingValue = "Deleting"; + /// Resource is being Moved. + private const string MovingValue = "Moving"; + /// Resource has Failed. + private const string FailedValue = "Failed"; + /// Resource has Succeeded. + private const string SucceededValue = "Succeeded"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public NetAppProvisioningState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(Models.NetAppProvisioningState left, Models.NetAppProvisioningState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(Models.NetAppProvisioningState left, Models.NetAppProvisioningState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator Models.NetAppProvisioningState(string value) => new Models.NetAppProvisioningState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator Models.NetAppProvisioningState?(string value) => value == null ? null : new Models.NetAppProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Models.NetAppProvisioningState other && Equals(other); + + /// + public bool Equals(Models.NetAppProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityContent.Serialization.cs deleted file mode 100644 index 9ba6a99edc24..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityContent.Serialization.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppQuotaAvailabilityContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppQuotaAvailabilityContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("type"u8); - writer.WriteStringValue(AvailabilityResourceType.ToString()); - writer.WritePropertyName("resourceGroup"u8); - writer.WriteStringValue(ResourceGroup); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppQuotaAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppQuotaAvailabilityContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppQuotaAvailabilityContent(document.RootElement, options); - } - - internal static NetAppQuotaAvailabilityContent DeserializeNetAppQuotaAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - NetAppQuotaAvailabilityResourceType type = default; - string resourceGroup = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new NetAppQuotaAvailabilityResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("resourceGroup"u8)) - { - resourceGroup = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppQuotaAvailabilityContent(name, type, resourceGroup, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppQuotaAvailabilityContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppQuotaAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppQuotaAvailabilityContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppQuotaAvailabilityContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityContent.cs deleted file mode 100644 index f5a651fc23cf..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityContent.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Quota availability request content. - public partial class NetAppQuotaAvailabilityContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Name of the resource to verify. - /// Resource type used for verification. - /// Resource group name. - /// or is null. - public NetAppQuotaAvailabilityContent(string name, NetAppQuotaAvailabilityResourceType availabilityResourceType, string resourceGroup) - { - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(resourceGroup, nameof(resourceGroup)); - - Name = name; - AvailabilityResourceType = availabilityResourceType; - ResourceGroup = resourceGroup; - } - - /// Initializes a new instance of . - /// Name of the resource to verify. - /// Resource type used for verification. - /// Resource group name. - /// Keeps track of any properties unknown to the library. - internal NetAppQuotaAvailabilityContent(string name, NetAppQuotaAvailabilityResourceType availabilityResourceType, string resourceGroup, IDictionary serializedAdditionalRawData) - { - Name = name; - AvailabilityResourceType = availabilityResourceType; - ResourceGroup = resourceGroup; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppQuotaAvailabilityContent() - { - } - - /// Name of the resource to verify. - public string Name { get; } - /// Resource type used for verification. - public NetAppQuotaAvailabilityResourceType AvailabilityResourceType { get; } - /// Resource group name. - public string ResourceGroup { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityResourceType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityResourceType.cs deleted file mode 100644 index 378fb36967e0..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppQuotaAvailabilityResourceType.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Resource type used for verification. - public readonly partial struct NetAppQuotaAvailabilityResourceType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppQuotaAvailabilityResourceType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string MicrosoftNetAppNetAppAccountsValue = "Microsoft.NetApp/netAppAccounts"; - private const string MicrosoftNetAppNetAppAccountsCapacityPoolsValue = "Microsoft.NetApp/netAppAccounts/capacityPools"; - private const string MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesValue = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes"; - private const string MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshotsValue = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots"; - - /// Microsoft.NetApp/netAppAccounts. - public static NetAppQuotaAvailabilityResourceType MicrosoftNetAppNetAppAccounts { get; } = new NetAppQuotaAvailabilityResourceType(MicrosoftNetAppNetAppAccountsValue); - /// Microsoft.NetApp/netAppAccounts/capacityPools. - public static NetAppQuotaAvailabilityResourceType MicrosoftNetAppNetAppAccountsCapacityPools { get; } = new NetAppQuotaAvailabilityResourceType(MicrosoftNetAppNetAppAccountsCapacityPoolsValue); - /// Microsoft.NetApp/netAppAccounts/capacityPools/volumes. - public static NetAppQuotaAvailabilityResourceType MicrosoftNetAppNetAppAccountsCapacityPoolsVolumes { get; } = new NetAppQuotaAvailabilityResourceType(MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesValue); - /// Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots. - public static NetAppQuotaAvailabilityResourceType MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshots { get; } = new NetAppQuotaAvailabilityResourceType(MicrosoftNetAppNetAppAccountsCapacityPoolsVolumesSnapshotsValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppQuotaAvailabilityResourceType left, NetAppQuotaAvailabilityResourceType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppQuotaAvailabilityResourceType left, NetAppQuotaAvailabilityResourceType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppQuotaAvailabilityResourceType(string value) => new NetAppQuotaAvailabilityResourceType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppQuotaAvailabilityResourceType other && Equals(other); - /// - public bool Equals(NetAppQuotaAvailabilityResourceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRegionInfo.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRegionInfo.Serialization.cs deleted file mode 100644 index 7526eb08ad40..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRegionInfo.Serialization.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppRegionInfo : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppRegionInfo)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(StorageToNetworkProximity)) - { - writer.WritePropertyName("storageToNetworkProximity"u8); - writer.WriteStringValue(StorageToNetworkProximity.Value.ToString()); - } - if (Optional.IsCollectionDefined(AvailabilityZoneMappings)) - { - writer.WritePropertyName("availabilityZoneMappings"u8); - writer.WriteStartArray(); - foreach (var item in AvailabilityZoneMappings) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppRegionInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppRegionInfo)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppRegionInfo(document.RootElement, options); - } - - internal static NetAppRegionInfo DeserializeNetAppRegionInfo(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RegionStorageToNetworkProximity? storageToNetworkProximity = default; - IReadOnlyList availabilityZoneMappings = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("storageToNetworkProximity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - storageToNetworkProximity = new RegionStorageToNetworkProximity(property.Value.GetString()); - continue; - } - if (property.NameEquals("availabilityZoneMappings"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AvailabilityZoneMapping.DeserializeAvailabilityZoneMapping(item, options)); - } - availabilityZoneMappings = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppRegionInfo(storageToNetworkProximity, availabilityZoneMappings ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppRegionInfo)} does not support writing '{options.Format}' format."); - } - } - - NetAppRegionInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppRegionInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppRegionInfo)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRegionInfo.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRegionInfo.cs deleted file mode 100644 index 5aff7dafe5aa..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRegionInfo.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Provides region specific information. - public partial class NetAppRegionInfo - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppRegionInfo() - { - AvailabilityZoneMappings = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Provides storage to network proximity information in the region. - /// Provides logical availability zone mappings for the subscription for a region. - /// Keeps track of any properties unknown to the library. - internal NetAppRegionInfo(RegionStorageToNetworkProximity? storageToNetworkProximity, IReadOnlyList availabilityZoneMappings, IDictionary serializedAdditionalRawData) - { - StorageToNetworkProximity = storageToNetworkProximity; - AvailabilityZoneMappings = availabilityZoneMappings; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Provides storage to network proximity information in the region. - public RegionStorageToNetworkProximity? StorageToNetworkProximity { get; } - /// Provides logical availability zone mappings for the subscription for a region. - public IReadOnlyList AvailabilityZoneMappings { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRelationshipStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRelationshipStatus.cs deleted file mode 100644 index 13d61ac19890..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRelationshipStatus.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// The status of the Volume Replication. - public readonly partial struct NetAppRelationshipStatus : IEquatable - { - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationSchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationSchedule.cs deleted file mode 100644 index b0d49565e0ab..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationSchedule.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Schedule. - public readonly partial struct NetAppReplicationSchedule : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppReplicationSchedule(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TenMinutelyValue = "_10minutely"; - private const string HourlyValue = "hourly"; - private const string DailyValue = "daily"; - - /// _10minutely. - public static NetAppReplicationSchedule TenMinutely { get; } = new NetAppReplicationSchedule(TenMinutelyValue); - /// hourly. - public static NetAppReplicationSchedule Hourly { get; } = new NetAppReplicationSchedule(HourlyValue); - /// daily. - public static NetAppReplicationSchedule Daily { get; } = new NetAppReplicationSchedule(DailyValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppReplicationSchedule left, NetAppReplicationSchedule right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppReplicationSchedule left, NetAppReplicationSchedule right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppReplicationSchedule(string value) => new NetAppReplicationSchedule(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppReplicationSchedule other && Equals(other); - /// - public bool Equals(NetAppReplicationSchedule other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationType.cs deleted file mode 100644 index 02523d059286..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Indicates whether the replication is cross zone or cross region. - public readonly partial struct NetAppReplicationType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppReplicationType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CrossRegionReplicationValue = "CrossRegionReplication"; - private const string CrossZoneReplicationValue = "CrossZoneReplication"; - - /// Cross region replication. - public static NetAppReplicationType CrossRegionReplication { get; } = new NetAppReplicationType(CrossRegionReplicationValue); - /// Cross zone replication. - public static NetAppReplicationType CrossZoneReplication { get; } = new NetAppReplicationType(CrossZoneReplicationValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppReplicationType left, NetAppReplicationType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppReplicationType left, NetAppReplicationType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppReplicationType(string value) => new NetAppReplicationType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppReplicationType other && Equals(other); - /// - public bool Equals(NetAppReplicationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRestoreStatus.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRestoreStatus.Serialization.cs index fc99ac7ec2bf..4d75ad179f24 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRestoreStatus.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRestoreStatus.Serialization.cs @@ -9,14 +9,16 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class NetAppRestoreStatus : IUtf8JsonSerializable, IJsonModel + /// Restore status. + public partial class NetAppRestoreStatus : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,16 +30,15 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppRestoreStatus)} does not support writing '{format}' format."); } - - if (options.Format != "W" && Optional.IsDefined(IsHealthy)) + if (options.Format != "W" && Optional.IsDefined(Healthy)) { writer.WritePropertyName("healthy"u8); - writer.WriteBooleanValue(IsHealthy.Value); + writer.WriteBooleanValue(Healthy.Value); } if (options.Format != "W" && Optional.IsDefined(RelationshipStatus)) { @@ -64,15 +65,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("totalTransferBytes"u8); writer.WriteNumberValue(TotalTransferBytes.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -81,88 +82,91 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NetAppRestoreStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + NetAppRestoreStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NetAppRestoreStatus JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppRestoreStatus)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeNetAppRestoreStatus(document.RootElement, options); } - internal static NetAppRestoreStatus DeserializeNetAppRestoreStatus(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NetAppRestoreStatus DeserializeNetAppRestoreStatus(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } bool? healthy = default; - NetAppRelationshipStatus? relationshipStatus = default; + VolumeRestoreRelationshipStatus? relationshipStatus = default; NetAppMirrorState? mirrorState = default; string unhealthyReason = default; string errorMessage = default; long? totalTransferBytes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("healthy"u8)) + if (prop.NameEquals("healthy"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - healthy = property.Value.GetBoolean(); + healthy = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("relationshipStatus"u8)) + if (prop.NameEquals("relationshipStatus"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - relationshipStatus = new NetAppRelationshipStatus(property.Value.GetString()); + relationshipStatus = new VolumeRestoreRelationshipStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("mirrorState"u8)) + if (prop.NameEquals("mirrorState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - mirrorState = new NetAppMirrorState(property.Value.GetString()); + mirrorState = new NetAppMirrorState(prop.Value.GetString()); continue; } - if (property.NameEquals("unhealthyReason"u8)) + if (prop.NameEquals("unhealthyReason"u8)) { - unhealthyReason = property.Value.GetString(); + unhealthyReason = prop.Value.GetString(); continue; } - if (property.NameEquals("errorMessage"u8)) + if (prop.NameEquals("errorMessage"u8)) { - errorMessage = property.Value.GetString(); + errorMessage = prop.Value.GetString(); continue; } - if (property.NameEquals("totalTransferBytes"u8)) + if (prop.NameEquals("totalTransferBytes"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - totalTransferBytes = property.Value.GetInt64(); + totalTransferBytes = prop.Value.GetInt64(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new NetAppRestoreStatus( healthy, relationshipStatus, @@ -170,13 +174,16 @@ internal static NetAppRestoreStatus DeserializeNetAppRestoreStatus(JsonElement e unhealthyReason, errorMessage, totalTransferBytes, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -186,15 +193,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - NetAppRestoreStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + NetAppRestoreStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NetAppRestoreStatus PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeNetAppRestoreStatus(document.RootElement, options); } default: @@ -202,6 +214,15 @@ NetAppRestoreStatus IPersistableModel.Create(BinaryData dat } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static NetAppRestoreStatus FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeNetAppRestoreStatus(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRestoreStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRestoreStatus.cs index ba55ce47e81e..1a5440180d1f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRestoreStatus.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppRestoreStatus.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.NetApp.Models /// Restore status. public partial class NetAppRestoreStatus { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal NetAppRestoreStatus() @@ -51,34 +22,39 @@ internal NetAppRestoreStatus() } /// Initializes a new instance of . - /// Restore health status. + /// Restore health status. /// Status of the restore SnapMirror relationship. - /// The mirror state property describes the current status of data replication for a restore. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. + /// The status of the restore. /// Reason for the unhealthy restore relationship. /// Displays error message if the restore is in an error state. /// Displays the total bytes transferred. - /// Keeps track of any properties unknown to the library. - internal NetAppRestoreStatus(bool? isHealthy, NetAppRelationshipStatus? relationshipStatus, NetAppMirrorState? mirrorState, string unhealthyReason, string errorMessage, long? totalTransferBytes, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal NetAppRestoreStatus(bool? healthy, VolumeRestoreRelationshipStatus? relationshipStatus, NetAppMirrorState? mirrorState, string unhealthyReason, string errorMessage, long? totalTransferBytes, IDictionary additionalBinaryDataProperties) { - IsHealthy = isHealthy; + Healthy = healthy; RelationshipStatus = relationshipStatus; MirrorState = mirrorState; UnhealthyReason = unhealthyReason; ErrorMessage = errorMessage; TotalTransferBytes = totalTransferBytes; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Restore health status. - public bool? IsHealthy { get; } + public bool? Healthy { get; } + /// Status of the restore SnapMirror relationship. - public NetAppRelationshipStatus? RelationshipStatus { get; } - /// The mirror state property describes the current status of data replication for a restore. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. + public VolumeRestoreRelationshipStatus? RelationshipStatus { get; } + + /// The status of the restore. public NetAppMirrorState? MirrorState { get; } + /// Reason for the unhealthy restore relationship. public string UnhealthyReason { get; } + /// Displays error message if the restore is in an error state. public string ErrorMessage { get; } + /// Displays the total bytes transferred. public long? TotalTransferBytes { get; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubscriptionQuotaItem.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubscriptionQuotaItem.Serialization.cs deleted file mode 100644 index d074d7440085..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubscriptionQuotaItem.Serialization.cs +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppSubscriptionQuotaItem : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppSubscriptionQuotaItem)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(Current)) - { - writer.WritePropertyName("current"u8); - writer.WriteNumberValue(Current.Value); - } - if (options.Format != "W" && Optional.IsDefined(Default)) - { - writer.WritePropertyName("default"u8); - writer.WriteNumberValue(Default.Value); - } - if (options.Format != "W" && Optional.IsDefined(Usage)) - { - if (Usage != null) - { - writer.WritePropertyName("usage"u8); - writer.WriteNumberValue(Usage.Value); - } - else - { - writer.WriteNull("usage"); - } - } - writer.WriteEndObject(); - } - - NetAppSubscriptionQuotaItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppSubscriptionQuotaItem)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppSubscriptionQuotaItem(document.RootElement, options); - } - - internal static NetAppSubscriptionQuotaItem DeserializeNetAppSubscriptionQuotaItem(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - int? current = default; - int? @default = default; - int? usage = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("current"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - current = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("default"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - @default = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("usage"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - usage = null; - continue; - } - usage = property0.Value.GetInt32(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppSubscriptionQuotaItem( - id, - name, - type, - systemData, - current, - @default, - usage, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppSubscriptionQuotaItem)} does not support writing '{options.Format}' format."); - } - } - - NetAppSubscriptionQuotaItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppSubscriptionQuotaItem(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppSubscriptionQuotaItem)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubscriptionQuotaItem.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubscriptionQuotaItem.cs deleted file mode 100644 index be4cef576499..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubscriptionQuotaItem.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Information regarding Quota Item. - public partial class NetAppSubscriptionQuotaItem : ResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppSubscriptionQuotaItem() - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The current quota value. - /// The default quota value. - /// The usage quota value. - /// Keeps track of any properties unknown to the library. - internal NetAppSubscriptionQuotaItem(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, int? current, int? @default, int? usage, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Current = current; - Default = @default; - Usage = usage; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The current quota value. - public int? Current { get; } - /// The default quota value. - public int? Default { get; } - /// The usage quota value. - public int? Usage { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeInfoPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeInfoPatch.Serialization.cs deleted file mode 100644 index bdecf61eddb8..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeInfoPatch.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppSubvolumeInfoPatch : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppSubvolumeInfoPatch)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Size)) - { - if (Size != null) - { - writer.WritePropertyName("size"u8); - writer.WriteNumberValue(Size.Value); - } - else - { - writer.WriteNull("size"); - } - } - if (Optional.IsDefined(Path)) - { - writer.WritePropertyName("path"u8); - writer.WriteStringValue(Path); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppSubvolumeInfoPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppSubvolumeInfoPatch)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppSubvolumeInfoPatch(document.RootElement, options); - } - - internal static NetAppSubvolumeInfoPatch DeserializeNetAppSubvolumeInfoPatch(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - long? size = default; - string path = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("size"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - size = null; - continue; - } - size = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("path"u8)) - { - path = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppSubvolumeInfoPatch(size, path, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppSubvolumeInfoPatch)} does not support writing '{options.Format}' format."); - } - } - - NetAppSubvolumeInfoPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppSubvolumeInfoPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppSubvolumeInfoPatch)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeInfoPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeInfoPatch.cs deleted file mode 100644 index d70b4be54e06..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeInfoPatch.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Subvolume Patch Request properties. - public partial class NetAppSubvolumeInfoPatch - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppSubvolumeInfoPatch() - { - } - - /// Initializes a new instance of . - /// Truncate subvolume to the provided size in bytes. - /// path to the subvolume. - /// Keeps track of any properties unknown to the library. - internal NetAppSubvolumeInfoPatch(long? size, string path, IDictionary serializedAdditionalRawData) - { - Size = size; - Path = path; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Truncate subvolume to the provided size in bytes. - public long? Size { get; set; } - /// path to the subvolume. - public string Path { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeMetadata.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeMetadata.Serialization.cs deleted file mode 100644 index 2fe39dd97aef..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeMetadata.Serialization.cs +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppSubvolumeMetadata : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppSubvolumeMetadata)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Path)) - { - writer.WritePropertyName("path"u8); - writer.WriteStringValue(Path); - } - if (Optional.IsDefined(ParentPath)) - { - writer.WritePropertyName("parentPath"u8); - writer.WriteStringValue(ParentPath); - } - if (Optional.IsDefined(Size)) - { - writer.WritePropertyName("size"u8); - writer.WriteNumberValue(Size.Value); - } - if (Optional.IsDefined(BytesUsed)) - { - writer.WritePropertyName("bytesUsed"u8); - writer.WriteNumberValue(BytesUsed.Value); - } - if (Optional.IsDefined(Permissions)) - { - writer.WritePropertyName("permissions"u8); - writer.WriteStringValue(Permissions); - } - if (Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("creationTimeStamp"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(AccessedOn)) - { - writer.WritePropertyName("accessedTimeStamp"u8); - writer.WriteStringValue(AccessedOn.Value, "O"); - } - if (Optional.IsDefined(ModifiedOn)) - { - writer.WritePropertyName("modifiedTimeStamp"u8); - writer.WriteStringValue(ModifiedOn.Value, "O"); - } - if (Optional.IsDefined(ChangedOn)) - { - writer.WritePropertyName("changedTimeStamp"u8); - writer.WriteStringValue(ChangedOn.Value, "O"); - } - if (Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - writer.WriteEndObject(); - } - - NetAppSubvolumeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppSubvolumeMetadata)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppSubvolumeMetadata(document.RootElement, options); - } - - internal static NetAppSubvolumeMetadata DeserializeNetAppSubvolumeMetadata(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string path = default; - string parentPath = default; - long? size = default; - long? bytesUsed = default; - string permissions = default; - DateTimeOffset? creationTimeStamp = default; - DateTimeOffset? accessedTimeStamp = default; - DateTimeOffset? modifiedTimeStamp = default; - DateTimeOffset? changedTimeStamp = default; - string provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("path"u8)) - { - path = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("parentPath"u8)) - { - parentPath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("size"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - size = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("bytesUsed"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - bytesUsed = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("permissions"u8)) - { - permissions = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("creationTimeStamp"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - creationTimeStamp = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("accessedTimeStamp"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - accessedTimeStamp = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("modifiedTimeStamp"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - modifiedTimeStamp = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("changedTimeStamp"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - changedTimeStamp = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppSubvolumeMetadata( - id, - name, - type, - systemData, - path, - parentPath, - size, - bytesUsed, - permissions, - creationTimeStamp, - accessedTimeStamp, - modifiedTimeStamp, - changedTimeStamp, - provisioningState, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppSubvolumeMetadata)} does not support writing '{options.Format}' format."); - } - } - - NetAppSubvolumeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppSubvolumeMetadata(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppSubvolumeMetadata)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeMetadata.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeMetadata.cs deleted file mode 100644 index 723711ab44a8..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppSubvolumeMetadata.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Result of the post subvolume and action is to get metadata of the subvolume. - public partial class NetAppSubvolumeMetadata : ResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppSubvolumeMetadata() - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Path to the subvolume. - /// Path to the parent subvolume. - /// Size of subvolume. - /// Bytes used. - /// Permissions of the subvolume. - /// Creation time and date. - /// Most recent access time and date. - /// Most recent modification time and date. - /// Most recent change time and date. - /// Azure lifecycle management. - /// Keeps track of any properties unknown to the library. - internal NetAppSubvolumeMetadata(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string path, string parentPath, long? size, long? bytesUsed, string permissions, DateTimeOffset? createdOn, DateTimeOffset? accessedOn, DateTimeOffset? modifiedOn, DateTimeOffset? changedOn, string provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Path = path; - ParentPath = parentPath; - Size = size; - BytesUsed = bytesUsed; - Permissions = permissions; - CreatedOn = createdOn; - AccessedOn = accessedOn; - ModifiedOn = modifiedOn; - ChangedOn = changedOn; - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Path to the subvolume. - public string Path { get; } - /// Path to the parent subvolume. - public string ParentPath { get; } - /// Size of subvolume. - public long? Size { get; } - /// Bytes used. - public long? BytesUsed { get; } - /// Permissions of the subvolume. - public string Permissions { get; } - /// Creation time and date. - public DateTimeOffset? CreatedOn { get; } - /// Most recent access time and date. - public DateTimeOffset? AccessedOn { get; } - /// Most recent modification time and date. - public DateTimeOffset? ModifiedOn { get; } - /// Most recent change time and date. - public DateTimeOffset? ChangedOn { get; } - /// Azure lifecycle management. - public string ProvisioningState { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageName.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageName.Serialization.cs deleted file mode 100644 index de2302b2ea20..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageName.Serialization.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppUsageName : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppUsageName)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Value)) - { - writer.WritePropertyName("value"u8); - writer.WriteStringValue(Value); - } - if (Optional.IsDefined(LocalizedValue)) - { - writer.WritePropertyName("localizedValue"u8); - writer.WriteStringValue(LocalizedValue); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppUsageName IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppUsageName)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppUsageName(document.RootElement, options); - } - - internal static NetAppUsageName DeserializeNetAppUsageName(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string value = default; - string localizedValue = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - value = property.Value.GetString(); - continue; - } - if (property.NameEquals("localizedValue"u8)) - { - localizedValue = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppUsageName(value, localizedValue, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppUsageName)} does not support writing '{options.Format}' format."); - } - } - - NetAppUsageName IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppUsageName(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppUsageName)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageName.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageName.cs deleted file mode 100644 index 1ccef44f2549..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageName.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// The name of the usage. - public partial class NetAppUsageName - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppUsageName() - { - } - - /// Initializes a new instance of . - /// The name of the usage. - /// The localized name of the usage. - /// Keeps track of any properties unknown to the library. - internal NetAppUsageName(string value, string localizedValue, IDictionary serializedAdditionalRawData) - { - Value = value; - LocalizedValue = localizedValue; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The name of the usage. - public string Value { get; } - /// The localized name of the usage. - public string LocalizedValue { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageResult.Serialization.cs deleted file mode 100644 index 5487eb4a789a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageResult.Serialization.cs +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppUsageResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppUsageResult)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W" && Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteObjectValue(Name, options); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(CurrentValue)) - { - writer.WritePropertyName("currentValue"u8); - writer.WriteNumberValue(CurrentValue.Value); - } - if (options.Format != "W" && Optional.IsDefined(Limit)) - { - writer.WritePropertyName("limit"u8); - writer.WriteNumberValue(Limit.Value); - } - if (options.Format != "W" && Optional.IsDefined(Unit)) - { - writer.WritePropertyName("unit"u8); - writer.WriteStringValue(Unit); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppUsageResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppUsageResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppUsageResult(document.RootElement, options); - } - - internal static NetAppUsageResult DeserializeNetAppUsageResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - NetAppUsageName name = default; - int? currentValue = default; - int? limit = default; - string unit = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("name"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - name = NetAppUsageName.DeserializeNetAppUsageName(property.Value, options); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("currentValue"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - currentValue = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("limit"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - limit = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("unit"u8)) - { - unit = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppUsageResult( - id, - name, - currentValue, - limit, - unit, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppUsageResult)} does not support writing '{options.Format}' format."); - } - } - - NetAppUsageResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppUsageResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppUsageResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageResult.cs deleted file mode 100644 index 0c9043f8ac9d..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppUsageResult.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Usages entity model. - public partial class NetAppUsageResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppUsageResult() - { - } - - /// Initializes a new instance of . - /// The id of the usage. - /// The name of the usage. - /// The current usage value for the subscription. - /// The limit of the usage. - /// The unit of the usage. - /// Keeps track of any properties unknown to the library. - internal NetAppUsageResult(string id, NetAppUsageName name, int? currentValue, int? limit, string unit, IDictionary serializedAdditionalRawData) - { - Id = id; - Name = name; - CurrentValue = currentValue; - Limit = limit; - Unit = unit; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The id of the usage. - public string Id { get; } - /// The name of the usage. - public NetAppUsageName Name { get; } - /// The current usage value for the subscription. - public int? CurrentValue { get; } - /// The limit of the usage. - public int? Limit { get; } - /// The unit of the usage. - public string Unit { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeAuthorizeReplicationContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeAuthorizeReplicationContent.Serialization.cs deleted file mode 100644 index 0615233e4a4f..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeAuthorizeReplicationContent.Serialization.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeAuthorizeReplicationContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeAuthorizeReplicationContent)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(RemoteVolumeResourceId)) - { - writer.WritePropertyName("remoteVolumeResourceId"u8); - writer.WriteStringValue(RemoteVolumeResourceId); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeAuthorizeReplicationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeAuthorizeReplicationContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeAuthorizeReplicationContent(document.RootElement, options); - } - - internal static NetAppVolumeAuthorizeReplicationContent DeserializeNetAppVolumeAuthorizeReplicationContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier remoteVolumeResourceId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("remoteVolumeResourceId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - remoteVolumeResourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeAuthorizeReplicationContent(remoteVolumeResourceId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeAuthorizeReplicationContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeAuthorizeReplicationContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeAuthorizeReplicationContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeAuthorizeReplicationContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeAuthorizeReplicationContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeAuthorizeReplicationContent.cs deleted file mode 100644 index 617a8f011fb0..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeAuthorizeReplicationContent.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Authorize request. - public partial class NetAppVolumeAuthorizeReplicationContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumeAuthorizeReplicationContent() - { - } - - /// Initializes a new instance of . - /// Resource id of the remote volume. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeAuthorizeReplicationContent(ResourceIdentifier remoteVolumeResourceId, IDictionary serializedAdditionalRawData) - { - RemoteVolumeResourceId = remoteVolumeResourceId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Resource id of the remote volume. - public ResourceIdentifier RemoteVolumeResourceId { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupBackupRestoreFilesContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupBackupRestoreFilesContent.Serialization.cs deleted file mode 100644 index d063c9b7c181..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupBackupRestoreFilesContent.Serialization.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeBackupBackupRestoreFilesContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeBackupBackupRestoreFilesContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("fileList"u8); - writer.WriteStartArray(); - foreach (var item in FileList) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(RestoreFilePath)) - { - writer.WritePropertyName("restoreFilePath"u8); - writer.WriteStringValue(RestoreFilePath); - } - writer.WritePropertyName("destinationVolumeId"u8); - writer.WriteStringValue(DestinationVolumeId); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeBackupBackupRestoreFilesContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeBackupBackupRestoreFilesContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeBackupBackupRestoreFilesContent(document.RootElement, options); - } - - internal static NetAppVolumeBackupBackupRestoreFilesContent DeserializeNetAppVolumeBackupBackupRestoreFilesContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList fileList = default; - string restoreFilePath = default; - ResourceIdentifier destinationVolumeId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("fileList"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - fileList = array; - continue; - } - if (property.NameEquals("restoreFilePath"u8)) - { - restoreFilePath = property.Value.GetString(); - continue; - } - if (property.NameEquals("destinationVolumeId"u8)) - { - destinationVolumeId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeBackupBackupRestoreFilesContent(fileList, restoreFilePath, destinationVolumeId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeBackupBackupRestoreFilesContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeBackupBackupRestoreFilesContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeBackupBackupRestoreFilesContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeBackupBackupRestoreFilesContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupBackupRestoreFilesContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupBackupRestoreFilesContent.cs deleted file mode 100644 index 508f343c084a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupBackupRestoreFilesContent.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Restore payload for Single File Backup Restore. - public partial class NetAppVolumeBackupBackupRestoreFilesContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// List of files to be restored. - /// Resource Id of the destination volume on which the files need to be restored. - /// or is null. - public NetAppVolumeBackupBackupRestoreFilesContent(IEnumerable fileList, ResourceIdentifier destinationVolumeId) - { - Argument.AssertNotNull(fileList, nameof(fileList)); - Argument.AssertNotNull(destinationVolumeId, nameof(destinationVolumeId)); - - FileList = fileList.ToList(); - DestinationVolumeId = destinationVolumeId; - } - - /// Initializes a new instance of . - /// List of files to be restored. - /// Destination folder where the files will be restored. The path name should start with a forward slash. If it is omitted from request then restore is done at the root folder of the destination volume by default. - /// Resource Id of the destination volume on which the files need to be restored. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeBackupBackupRestoreFilesContent(IList fileList, string restoreFilePath, ResourceIdentifier destinationVolumeId, IDictionary serializedAdditionalRawData) - { - FileList = fileList; - RestoreFilePath = restoreFilePath; - DestinationVolumeId = destinationVolumeId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppVolumeBackupBackupRestoreFilesContent() - { - } - - /// List of files to be restored. - public IList FileList { get; } - /// Destination folder where the files will be restored. The path name should start with a forward slash. If it is omitted from request then restore is done at the root folder of the destination volume by default. - public string RestoreFilePath { get; set; } - /// Resource Id of the destination volume on which the files need to be restored. - public ResourceIdentifier DestinationVolumeId { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupConfiguration.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupConfiguration.Serialization.cs deleted file mode 100644 index 13b170621404..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupConfiguration.Serialization.cs +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeBackupConfiguration : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeBackupConfiguration)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(BackupPolicyId)) - { - writer.WritePropertyName("backupPolicyId"u8); - writer.WriteStringValue(BackupPolicyId); - } - if (Optional.IsDefined(IsPolicyEnforced)) - { - writer.WritePropertyName("policyEnforced"u8); - writer.WriteBooleanValue(IsPolicyEnforced.Value); - } - if (Optional.IsDefined(BackupVaultId)) - { - writer.WritePropertyName("backupVaultId"u8); - writer.WriteStringValue(BackupVaultId); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeBackupConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeBackupConfiguration)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeBackupConfiguration(document.RootElement, options); - } - - internal static NetAppVolumeBackupConfiguration DeserializeNetAppVolumeBackupConfiguration(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier backupPolicyId = default; - bool? policyEnforced = default; - ResourceIdentifier backupVaultId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("backupPolicyId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - backupPolicyId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("policyEnforced"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - policyEnforced = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("backupVaultId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - backupVaultId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeBackupConfiguration(backupPolicyId, policyEnforced, backupVaultId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeBackupConfiguration)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeBackupConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeBackupConfiguration(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeBackupConfiguration)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupConfiguration.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupConfiguration.cs deleted file mode 100644 index f1880ee68c2a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupConfiguration.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Volume Backup Properties. - public partial class NetAppVolumeBackupConfiguration - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Backup Policy Resource ID. - /// Policy Enforced. - /// Backup Vault Resource ID. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeBackupConfiguration(ResourceIdentifier backupPolicyId, bool? isPolicyEnforced, ResourceIdentifier backupVaultId, IDictionary serializedAdditionalRawData) - { - BackupPolicyId = backupPolicyId; - IsPolicyEnforced = isPolicyEnforced; - BackupVaultId = backupVaultId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Backup Policy Resource ID. - public ResourceIdentifier BackupPolicyId { get; set; } - /// Policy Enforced. - public bool? IsPolicyEnforced { get; set; } - /// Backup Vault Resource ID. - public ResourceIdentifier BackupVaultId { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupDetail.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupDetail.Serialization.cs deleted file mode 100644 index 18333a189297..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupDetail.Serialization.cs +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeBackupDetail : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeBackupDetail)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(VolumeName)) - { - writer.WritePropertyName("volumeName"u8); - writer.WriteStringValue(VolumeName); - } - if (Optional.IsDefined(VolumeResourceId)) - { - writer.WritePropertyName("volumeResourceId"u8); - writer.WriteStringValue(VolumeResourceId); - } - if (Optional.IsDefined(BackupsCount)) - { - writer.WritePropertyName("backupsCount"u8); - writer.WriteNumberValue(BackupsCount.Value); - } - if (Optional.IsDefined(IsPolicyEnabled)) - { - writer.WritePropertyName("policyEnabled"u8); - writer.WriteBooleanValue(IsPolicyEnabled.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeBackupDetail IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeBackupDetail)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeBackupDetail(document.RootElement, options); - } - - internal static NetAppVolumeBackupDetail DeserializeNetAppVolumeBackupDetail(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string volumeName = default; - ResourceIdentifier volumeResourceId = default; - int? backupsCount = default; - bool? policyEnabled = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("volumeName"u8)) - { - volumeName = property.Value.GetString(); - continue; - } - if (property.NameEquals("volumeResourceId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - volumeResourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("backupsCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - backupsCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("policyEnabled"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - policyEnabled = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeBackupDetail(volumeName, volumeResourceId, backupsCount, policyEnabled, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeBackupDetail)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeBackupDetail IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeBackupDetail(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeBackupDetail)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupDetail.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupDetail.cs deleted file mode 100644 index c5f82302155d..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupDetail.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Volume details using the backup policy. - public partial class NetAppVolumeBackupDetail - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppVolumeBackupDetail() - { - } - - /// Initializes a new instance of . - /// Volume name. - /// ResourceId used to identify the Volume. - /// Total count of backups for volume. - /// Policy enabled. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeBackupDetail(string volumeName, ResourceIdentifier volumeResourceId, int? backupsCount, bool? isPolicyEnabled, IDictionary serializedAdditionalRawData) - { - VolumeName = volumeName; - VolumeResourceId = volumeResourceId; - BackupsCount = backupsCount; - IsPolicyEnabled = isPolicyEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Volume name. - public string VolumeName { get; } - /// ResourceId used to identify the Volume. - public ResourceIdentifier VolumeResourceId { get; } - /// Total count of backups for volume. - public int? BackupsCount { get; } - /// Policy enabled. - public bool? IsPolicyEnabled { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupStatus.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupStatus.Serialization.cs index f73094557e9c..9f5be6a48340 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupStatus.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupStatus.Serialization.cs @@ -9,14 +9,16 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class NetAppVolumeBackupStatus : IUtf8JsonSerializable, IJsonModel + /// Backup status. + public partial class NetAppVolumeBackupStatus : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,16 +30,15 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppVolumeBackupStatus)} does not support writing '{format}' format."); } - - if (options.Format != "W" && Optional.IsDefined(IsHealthy)) + if (options.Format != "W" && Optional.IsDefined(Healthy)) { writer.WritePropertyName("healthy"u8); - writer.WriteBooleanValue(IsHealthy.Value); + writer.WriteBooleanValue(Healthy.Value); } if (options.Format != "W" && Optional.IsDefined(RelationshipStatus)) { @@ -79,15 +80,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("transferProgressBytes"u8); writer.WriteNumberValue(TransferProgressBytes.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -96,28 +97,33 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NetAppVolumeBackupStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + NetAppVolumeBackupStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NetAppVolumeBackupStatus JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppVolumeBackupStatus)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeNetAppVolumeBackupStatus(document.RootElement, options); } - internal static NetAppVolumeBackupStatus DeserializeNetAppVolumeBackupStatus(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NetAppVolumeBackupStatus DeserializeNetAppVolumeBackupStatus(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } bool? healthy = default; - NetAppRelationshipStatus? relationshipStatus = default; + VolumeBackupRelationshipStatus? relationshipStatus = default; NetAppMirrorState? mirrorState = default; string unhealthyReason = default; string errorMessage = default; @@ -125,85 +131,83 @@ internal static NetAppVolumeBackupStatus DeserializeNetAppVolumeBackupStatus(Jso string lastTransferType = default; long? totalTransferBytes = default; long? transferProgressBytes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("healthy"u8)) + if (prop.NameEquals("healthy"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - healthy = property.Value.GetBoolean(); + healthy = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("relationshipStatus"u8)) + if (prop.NameEquals("relationshipStatus"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - relationshipStatus = new NetAppRelationshipStatus(property.Value.GetString()); + relationshipStatus = new VolumeBackupRelationshipStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("mirrorState"u8)) + if (prop.NameEquals("mirrorState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - mirrorState = new NetAppMirrorState(property.Value.GetString()); + mirrorState = new NetAppMirrorState(prop.Value.GetString()); continue; } - if (property.NameEquals("unhealthyReason"u8)) + if (prop.NameEquals("unhealthyReason"u8)) { - unhealthyReason = property.Value.GetString(); + unhealthyReason = prop.Value.GetString(); continue; } - if (property.NameEquals("errorMessage"u8)) + if (prop.NameEquals("errorMessage"u8)) { - errorMessage = property.Value.GetString(); + errorMessage = prop.Value.GetString(); continue; } - if (property.NameEquals("lastTransferSize"u8)) + if (prop.NameEquals("lastTransferSize"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - lastTransferSize = property.Value.GetInt64(); + lastTransferSize = prop.Value.GetInt64(); continue; } - if (property.NameEquals("lastTransferType"u8)) + if (prop.NameEquals("lastTransferType"u8)) { - lastTransferType = property.Value.GetString(); + lastTransferType = prop.Value.GetString(); continue; } - if (property.NameEquals("totalTransferBytes"u8)) + if (prop.NameEquals("totalTransferBytes"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - totalTransferBytes = property.Value.GetInt64(); + totalTransferBytes = prop.Value.GetInt64(); continue; } - if (property.NameEquals("transferProgressBytes"u8)) + if (prop.NameEquals("transferProgressBytes"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - transferProgressBytes = property.Value.GetInt64(); + transferProgressBytes = prop.Value.GetInt64(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new NetAppVolumeBackupStatus( healthy, relationshipStatus, @@ -214,13 +218,16 @@ internal static NetAppVolumeBackupStatus DeserializeNetAppVolumeBackupStatus(Jso lastTransferType, totalTransferBytes, transferProgressBytes, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -230,15 +237,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - NetAppVolumeBackupStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + NetAppVolumeBackupStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NetAppVolumeBackupStatus PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeNetAppVolumeBackupStatus(document.RootElement, options); } default: @@ -246,6 +258,15 @@ NetAppVolumeBackupStatus IPersistableModel.Create(Bina } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static NetAppVolumeBackupStatus FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeNetAppVolumeBackupStatus(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupStatus.cs index 03f2ed474401..a92201748b42 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupStatus.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBackupStatus.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.NetApp.Models /// Backup status. public partial class NetAppVolumeBackupStatus { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal NetAppVolumeBackupStatus() @@ -51,19 +22,19 @@ internal NetAppVolumeBackupStatus() } /// Initializes a new instance of . - /// Backup health status. + /// Backup health status. /// Status of the backup mirror relationship. - /// The mirror state property describes the current status of data replication for a backup. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. + /// The status of the backup. /// Reason for the unhealthy backup relationship. /// Displays error message if the backup is in an error state. /// Displays the last transfer size. /// Displays the last transfer type. /// Displays the total bytes transferred. /// Displays the total number of bytes transferred for the ongoing operation. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeBackupStatus(bool? isHealthy, NetAppRelationshipStatus? relationshipStatus, NetAppMirrorState? mirrorState, string unhealthyReason, string errorMessage, long? lastTransferSize, string lastTransferType, long? totalTransferBytes, long? transferProgressBytes, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal NetAppVolumeBackupStatus(bool? healthy, VolumeBackupRelationshipStatus? relationshipStatus, NetAppMirrorState? mirrorState, string unhealthyReason, string errorMessage, long? lastTransferSize, string lastTransferType, long? totalTransferBytes, long? transferProgressBytes, IDictionary additionalBinaryDataProperties) { - IsHealthy = isHealthy; + Healthy = healthy; RelationshipStatus = relationshipStatus; MirrorState = mirrorState; UnhealthyReason = unhealthyReason; @@ -72,25 +43,33 @@ internal NetAppVolumeBackupStatus(bool? isHealthy, NetAppRelationshipStatus? rel LastTransferType = lastTransferType; TotalTransferBytes = totalTransferBytes; TransferProgressBytes = transferProgressBytes; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Backup health status. - public bool? IsHealthy { get; } + public bool? Healthy { get; } + /// Status of the backup mirror relationship. - public NetAppRelationshipStatus? RelationshipStatus { get; } - /// The mirror state property describes the current status of data replication for a backup. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. + public VolumeBackupRelationshipStatus? RelationshipStatus { get; } + + /// The status of the backup. public NetAppMirrorState? MirrorState { get; } + /// Reason for the unhealthy backup relationship. public string UnhealthyReason { get; } + /// Displays error message if the backup is in an error state. public string ErrorMessage { get; } + /// Displays the last transfer size. public long? LastTransferSize { get; } + /// Displays the last transfer type. public string LastTransferType { get; } + /// Displays the total bytes transferred. public long? TotalTransferBytes { get; } + /// Displays the total number of bytes transferred for the ongoing operation. public long? TransferProgressBytes { get; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakFileLocksContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakFileLocksContent.Serialization.cs deleted file mode 100644 index 07e62cc2bf0c..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakFileLocksContent.Serialization.cs +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Net; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeBreakFileLocksContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeBreakFileLocksContent)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ClientIP)) - { - writer.WritePropertyName("clientIp"u8); - writer.WriteStringValue(ClientIP.ToString()); - } - if (Optional.IsDefined(ConfirmRunningDisruptiveOperation)) - { - writer.WritePropertyName("confirmRunningDisruptiveOperation"u8); - writer.WriteBooleanValue(ConfirmRunningDisruptiveOperation.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeBreakFileLocksContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeBreakFileLocksContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeBreakFileLocksContent(document.RootElement, options); - } - - internal static NetAppVolumeBreakFileLocksContent DeserializeNetAppVolumeBreakFileLocksContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IPAddress clientIP = default; - bool? confirmRunningDisruptiveOperation = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("clientIp"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - clientIP = IPAddress.Parse(property.Value.GetString()); - continue; - } - if (property.NameEquals("confirmRunningDisruptiveOperation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - confirmRunningDisruptiveOperation = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeBreakFileLocksContent(clientIP, confirmRunningDisruptiveOperation, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeBreakFileLocksContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeBreakFileLocksContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeBreakFileLocksContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeBreakFileLocksContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakFileLocksContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakFileLocksContent.cs deleted file mode 100644 index 7641377bab21..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakFileLocksContent.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Net; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Break file locks request. - public partial class NetAppVolumeBreakFileLocksContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumeBreakFileLocksContent() - { - } - - /// Initializes a new instance of . - /// To clear file locks on a volume for a particular client. - /// Break File locks could be a disruptive operation for application as locks on the volume will be broken, if want to process, set to true. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeBreakFileLocksContent(IPAddress clientIP, bool? confirmRunningDisruptiveOperation, IDictionary serializedAdditionalRawData) - { - ClientIP = clientIP; - ConfirmRunningDisruptiveOperation = confirmRunningDisruptiveOperation; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// To clear file locks on a volume for a particular client. - public IPAddress ClientIP { get; set; } - /// Break File locks could be a disruptive operation for application as locks on the volume will be broken, if want to process, set to true. - public bool? ConfirmRunningDisruptiveOperation { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakReplicationContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakReplicationContent.Serialization.cs deleted file mode 100644 index 4b8f17c7b848..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakReplicationContent.Serialization.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeBreakReplicationContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeBreakReplicationContent)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ForceBreakReplication)) - { - writer.WritePropertyName("forceBreakReplication"u8); - writer.WriteBooleanValue(ForceBreakReplication.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeBreakReplicationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeBreakReplicationContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeBreakReplicationContent(document.RootElement, options); - } - - internal static NetAppVolumeBreakReplicationContent DeserializeNetAppVolumeBreakReplicationContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? forceBreakReplication = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("forceBreakReplication"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - forceBreakReplication = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeBreakReplicationContent(forceBreakReplication, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeBreakReplicationContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeBreakReplicationContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeBreakReplicationContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeBreakReplicationContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakReplicationContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakReplicationContent.cs deleted file mode 100644 index b983b26af163..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeBreakReplicationContent.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Break replication request. - public partial class NetAppVolumeBreakReplicationContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumeBreakReplicationContent() - { - } - - /// Initializes a new instance of . - /// If replication is in status transferring and you want to force break the replication, set to true. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeBreakReplicationContent(bool? forceBreakReplication, IDictionary serializedAdditionalRawData) - { - ForceBreakReplication = forceBreakReplication; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// If replication is in status transferring and you want to force break the replication, set to true. - public bool? ForceBreakReplication { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeDataProtection.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeDataProtection.Serialization.cs deleted file mode 100644 index 01bd2d7f9b18..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeDataProtection.Serialization.cs +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeDataProtection : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeDataProtection)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Backup)) - { - writer.WritePropertyName("backup"u8); - writer.WriteObjectValue(Backup, options); - } - if (Optional.IsDefined(Replication)) - { - writer.WritePropertyName("replication"u8); - writer.WriteObjectValue(Replication, options); - } - if (Optional.IsDefined(Snapshot)) - { - writer.WritePropertyName("snapshot"u8); - writer.WriteObjectValue(Snapshot, options); - } - if (Optional.IsDefined(VolumeRelocation)) - { - writer.WritePropertyName("volumeRelocation"u8); - writer.WriteObjectValue(VolumeRelocation, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeDataProtection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeDataProtection)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeDataProtection(document.RootElement, options); - } - - internal static NetAppVolumeDataProtection DeserializeNetAppVolumeDataProtection(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - NetAppVolumeBackupConfiguration backup = default; - NetAppReplicationObject replication = default; - VolumeSnapshotProperties snapshot = default; - NetAppVolumeRelocationProperties volumeRelocation = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("backup"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - backup = NetAppVolumeBackupConfiguration.DeserializeNetAppVolumeBackupConfiguration(property.Value, options); - continue; - } - if (property.NameEquals("replication"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - replication = NetAppReplicationObject.DeserializeNetAppReplicationObject(property.Value, options); - continue; - } - if (property.NameEquals("snapshot"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - snapshot = VolumeSnapshotProperties.DeserializeVolumeSnapshotProperties(property.Value, options); - continue; - } - if (property.NameEquals("volumeRelocation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - volumeRelocation = NetAppVolumeRelocationProperties.DeserializeNetAppVolumeRelocationProperties(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeDataProtection(backup, replication, snapshot, volumeRelocation, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeDataProtection)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeDataProtection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeDataProtection(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeDataProtection)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeDataProtection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeDataProtection.cs deleted file mode 100644 index a61e8bcc90d6..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeDataProtection.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// DataProtection type volumes include an object containing details of the replication. - public partial class NetAppVolumeDataProtection - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumeDataProtection() - { - } - - /// Initializes a new instance of . - /// Backup Properties. - /// Replication properties. - /// Snapshot properties. - /// VolumeRelocation properties. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeDataProtection(NetAppVolumeBackupConfiguration backup, NetAppReplicationObject replication, VolumeSnapshotProperties snapshot, NetAppVolumeRelocationProperties volumeRelocation, IDictionary serializedAdditionalRawData) - { - Backup = backup; - Replication = replication; - Snapshot = snapshot; - VolumeRelocation = volumeRelocation; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Backup Properties. - public NetAppVolumeBackupConfiguration Backup { get; set; } - /// Replication properties. - public NetAppReplicationObject Replication { get; set; } - /// Snapshot properties. - internal VolumeSnapshotProperties Snapshot { get; set; } - /// Snapshot Policy ResourceId. - public ResourceIdentifier SnapshotPolicyId - { - get => Snapshot is null ? default : Snapshot.SnapshotPolicyId; - set - { - if (Snapshot is null) - Snapshot = new VolumeSnapshotProperties(); - Snapshot.SnapshotPolicyId = value; - } - } - - /// VolumeRelocation properties. - public NetAppVolumeRelocationProperties VolumeRelocation { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeExportPolicyRule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeExportPolicyRule.Serialization.cs index 85aec44188f0..594f36beec8e 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeExportPolicyRule.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeExportPolicyRule.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class NetAppVolumeExportPolicyRule : IUtf8JsonSerializable, IJsonModel + /// Set of export policy rules. + internal partial class NetAppVolumeExportPolicyRule : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,96 +29,30 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppVolumeExportPolicyRule)} does not support writing '{format}' format."); } - - if (Optional.IsDefined(RuleIndex)) - { - writer.WritePropertyName("ruleIndex"u8); - writer.WriteNumberValue(RuleIndex.Value); - } - if (Optional.IsDefined(IsUnixReadOnly)) - { - writer.WritePropertyName("unixReadOnly"u8); - writer.WriteBooleanValue(IsUnixReadOnly.Value); - } - if (Optional.IsDefined(IsUnixReadWrite)) - { - writer.WritePropertyName("unixReadWrite"u8); - writer.WriteBooleanValue(IsUnixReadWrite.Value); - } - if (Optional.IsDefined(IsKerberos5ReadOnly)) - { - writer.WritePropertyName("kerberos5ReadOnly"u8); - writer.WriteBooleanValue(IsKerberos5ReadOnly.Value); - } - if (Optional.IsDefined(IsKerberos5ReadWrite)) - { - writer.WritePropertyName("kerberos5ReadWrite"u8); - writer.WriteBooleanValue(IsKerberos5ReadWrite.Value); - } - if (Optional.IsDefined(IsKerberos5iReadOnly)) - { - writer.WritePropertyName("kerberos5iReadOnly"u8); - writer.WriteBooleanValue(IsKerberos5iReadOnly.Value); - } - if (Optional.IsDefined(IsKerberos5iReadWrite)) - { - writer.WritePropertyName("kerberos5iReadWrite"u8); - writer.WriteBooleanValue(IsKerberos5iReadWrite.Value); - } - if (Optional.IsDefined(IsKerberos5pReadOnly)) - { - writer.WritePropertyName("kerberos5pReadOnly"u8); - writer.WriteBooleanValue(IsKerberos5pReadOnly.Value); - } - if (Optional.IsDefined(IsKerberos5pReadWrite)) - { - writer.WritePropertyName("kerberos5pReadWrite"u8); - writer.WriteBooleanValue(IsKerberos5pReadWrite.Value); - } - if (Optional.IsDefined(AllowCifsProtocol)) - { - writer.WritePropertyName("cifs"u8); - writer.WriteBooleanValue(AllowCifsProtocol.Value); - } - if (Optional.IsDefined(AllowNfsV3Protocol)) - { - writer.WritePropertyName("nfsv3"u8); - writer.WriteBooleanValue(AllowNfsV3Protocol.Value); - } - if (Optional.IsDefined(AllowNfsV41Protocol)) - { - writer.WritePropertyName("nfsv41"u8); - writer.WriteBooleanValue(AllowNfsV41Protocol.Value); - } - if (Optional.IsDefined(AllowedClients)) - { - writer.WritePropertyName("allowedClients"u8); - writer.WriteStringValue(AllowedClients); - } - if (Optional.IsDefined(HasRootAccess)) - { - writer.WritePropertyName("hasRootAccess"u8); - writer.WriteBooleanValue(HasRootAccess.Value); - } - if (Optional.IsDefined(ChownMode)) + if (Optional.IsCollectionDefined(Rules)) { - writer.WritePropertyName("chownMode"u8); - writer.WriteStringValue(ChownMode.Value.ToString()); + writer.WritePropertyName("rules"u8); + writer.WriteStartArray(); + foreach (ExportPolicyRule item in Rules) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -126,205 +61,64 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NetAppVolumeExportPolicyRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + NetAppVolumeExportPolicyRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NetAppVolumeExportPolicyRule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppVolumeExportPolicyRule)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeNetAppVolumeExportPolicyRule(document.RootElement, options); } - internal static NetAppVolumeExportPolicyRule DeserializeNetAppVolumeExportPolicyRule(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NetAppVolumeExportPolicyRule DeserializeNetAppVolumeExportPolicyRule(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - int? ruleIndex = default; - bool? unixReadOnly = default; - bool? unixReadWrite = default; - bool? kerberos5ReadOnly = default; - bool? kerberos5ReadWrite = default; - bool? kerberos5iReadOnly = default; - bool? kerberos5iReadWrite = default; - bool? kerberos5pReadOnly = default; - bool? kerberos5pReadWrite = default; - bool? cifs = default; - bool? nfsv3 = default; - bool? nfsv41 = default; - string allowedClients = default; - bool? hasRootAccess = default; - NetAppChownMode? chownMode = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList rules = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("ruleIndex"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - ruleIndex = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("unixReadOnly"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - unixReadOnly = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("unixReadWrite"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - unixReadWrite = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("kerberos5ReadOnly"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kerberos5ReadOnly = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("kerberos5ReadWrite"u8)) + if (prop.NameEquals("rules"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - kerberos5ReadWrite = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("kerberos5iReadOnly"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kerberos5iReadOnly = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("kerberos5iReadWrite"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kerberos5iReadWrite = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("kerberos5pReadOnly"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kerberos5pReadOnly = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("kerberos5pReadWrite"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kerberos5pReadWrite = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("cifs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - cifs = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("nfsv3"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nfsv3 = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("nfsv41"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nfsv41 = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("allowedClients"u8)) - { - allowedClients = property.Value.GetString(); - continue; - } - if (property.NameEquals("hasRootAccess"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - continue; - } - hasRootAccess = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("chownMode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; + array.Add(ExportPolicyRule.DeserializeExportPolicyRule(item, options)); } - chownMode = new NetAppChownMode(property.Value.GetString()); + rules = array; continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeExportPolicyRule( - ruleIndex, - unixReadOnly, - unixReadWrite, - kerberos5ReadOnly, - kerberos5ReadWrite, - kerberos5iReadOnly, - kerberos5iReadWrite, - kerberos5pReadOnly, - kerberos5pReadWrite, - cifs, - nfsv3, - nfsv41, - allowedClients, - hasRootAccess, - chownMode, - serializedAdditionalRawData); + return new NetAppVolumeExportPolicyRule(rules ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -334,15 +128,20 @@ BinaryData IPersistableModel.Write(ModelReaderWrit } } - NetAppVolumeExportPolicyRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + NetAppVolumeExportPolicyRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NetAppVolumeExportPolicyRule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeNetAppVolumeExportPolicyRule(document.RootElement, options); } default: @@ -350,6 +149,7 @@ NetAppVolumeExportPolicyRule IPersistableModel.Cre } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeExportPolicyRule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeExportPolicyRule.cs index ff4d0fc308bb..93a8e74febc7 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeExportPolicyRule.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeExportPolicyRule.cs @@ -7,115 +7,32 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - /// Volume Export Policy Rule. - public partial class NetAppVolumeExportPolicyRule + /// Set of export policy rules. + internal partial class NetAppVolumeExportPolicyRule { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public NetAppVolumeExportPolicyRule() { + Rules = new ChangeTrackingList(); } /// Initializes a new instance of . - /// Order index. - /// Read only access. - /// Read and write access. - /// Kerberos5 Read only access. To be use with swagger version 2020-05-01 or later. - /// Kerberos5 Read and write access. To be use with swagger version 2020-05-01 or later. - /// Kerberos5i Read only access. To be use with swagger version 2020-05-01 or later. - /// Kerberos5i Read and write access. To be use with swagger version 2020-05-01 or later. - /// Kerberos5p Read only access. To be use with swagger version 2020-05-01 or later. - /// Kerberos5p Read and write access. To be use with swagger version 2020-05-01 or later. - /// Allows CIFS protocol. - /// Allows NFSv3 protocol. Enable only for NFSv3 type volumes. - /// Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes. - /// Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names. - /// Has root access to volume. - /// This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root users can change ownership of files that they own. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeExportPolicyRule(int? ruleIndex, bool? isUnixReadOnly, bool? isUnixReadWrite, bool? isKerberos5ReadOnly, bool? isKerberos5ReadWrite, bool? isKerberos5iReadOnly, bool? isKerberos5iReadWrite, bool? isKerberos5pReadOnly, bool? isKerberos5pReadWrite, bool? allowCifsProtocol, bool? allowNfsV3Protocol, bool? allowNfsV41Protocol, string allowedClients, bool? hasRootAccess, NetAppChownMode? chownMode, IDictionary serializedAdditionalRawData) + /// Export policy rule. + /// Keeps track of any properties unknown to the library. + internal NetAppVolumeExportPolicyRule(IList rules, IDictionary additionalBinaryDataProperties) { - RuleIndex = ruleIndex; - IsUnixReadOnly = isUnixReadOnly; - IsUnixReadWrite = isUnixReadWrite; - IsKerberos5ReadOnly = isKerberos5ReadOnly; - IsKerberos5ReadWrite = isKerberos5ReadWrite; - IsKerberos5iReadOnly = isKerberos5iReadOnly; - IsKerberos5iReadWrite = isKerberos5iReadWrite; - IsKerberos5pReadOnly = isKerberos5pReadOnly; - IsKerberos5pReadWrite = isKerberos5pReadWrite; - AllowCifsProtocol = allowCifsProtocol; - AllowNfsV3Protocol = allowNfsV3Protocol; - AllowNfsV41Protocol = allowNfsV41Protocol; - AllowedClients = allowedClients; - HasRootAccess = hasRootAccess; - ChownMode = chownMode; - _serializedAdditionalRawData = serializedAdditionalRawData; + Rules = rules; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Order index. - public int? RuleIndex { get; set; } - /// Read only access. - public bool? IsUnixReadOnly { get; set; } - /// Read and write access. - public bool? IsUnixReadWrite { get; set; } - /// Kerberos5 Read only access. To be use with swagger version 2020-05-01 or later. - public bool? IsKerberos5ReadOnly { get; set; } - /// Kerberos5 Read and write access. To be use with swagger version 2020-05-01 or later. - public bool? IsKerberos5ReadWrite { get; set; } - /// Kerberos5i Read only access. To be use with swagger version 2020-05-01 or later. - public bool? IsKerberos5iReadOnly { get; set; } - /// Kerberos5i Read and write access. To be use with swagger version 2020-05-01 or later. - public bool? IsKerberos5iReadWrite { get; set; } - /// Kerberos5p Read only access. To be use with swagger version 2020-05-01 or later. - public bool? IsKerberos5pReadOnly { get; set; } - /// Kerberos5p Read and write access. To be use with swagger version 2020-05-01 or later. - public bool? IsKerberos5pReadWrite { get; set; } - /// Allows CIFS protocol. - public bool? AllowCifsProtocol { get; set; } - /// Allows NFSv3 protocol. Enable only for NFSv3 type volumes. - public bool? AllowNfsV3Protocol { get; set; } - /// Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes. - public bool? AllowNfsV41Protocol { get; set; } - /// Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names. - public string AllowedClients { get; set; } - /// Has root access to volume. - public bool? HasRootAccess { get; set; } - /// This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root users can change ownership of files that they own. - public NetAppChownMode? ChownMode { get; set; } + /// Export policy rule. + public IList Rules { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupMetadata.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupMetadata.Serialization.cs deleted file mode 100644 index 880725eaab59..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupMetadata.Serialization.cs +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeGroupMetadata : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeGroupMetadata)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(GroupDescription)) - { - writer.WritePropertyName("groupDescription"u8); - writer.WriteStringValue(GroupDescription); - } - if (Optional.IsDefined(ApplicationType)) - { - writer.WritePropertyName("applicationType"u8); - writer.WriteStringValue(ApplicationType.Value.ToString()); - } - if (Optional.IsDefined(ApplicationIdentifier)) - { - writer.WritePropertyName("applicationIdentifier"u8); - writer.WriteStringValue(ApplicationIdentifier); - } - if (Optional.IsCollectionDefined(GlobalPlacementRules)) - { - writer.WritePropertyName("globalPlacementRules"u8); - writer.WriteStartArray(); - foreach (var item in GlobalPlacementRules) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(VolumesCount)) - { - writer.WritePropertyName("volumesCount"u8); - writer.WriteNumberValue(VolumesCount.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeGroupMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeGroupMetadata)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeGroupMetadata(document.RootElement, options); - } - - internal static NetAppVolumeGroupMetadata DeserializeNetAppVolumeGroupMetadata(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string groupDescription = default; - NetAppApplicationType? applicationType = default; - string applicationIdentifier = default; - IList globalPlacementRules = default; - long? volumesCount = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("groupDescription"u8)) - { - groupDescription = property.Value.GetString(); - continue; - } - if (property.NameEquals("applicationType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - applicationType = new NetAppApplicationType(property.Value.GetString()); - continue; - } - if (property.NameEquals("applicationIdentifier"u8)) - { - applicationIdentifier = property.Value.GetString(); - continue; - } - if (property.NameEquals("globalPlacementRules"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(NetAppVolumePlacementRule.DeserializeNetAppVolumePlacementRule(item, options)); - } - globalPlacementRules = array; - continue; - } - if (property.NameEquals("volumesCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - volumesCount = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeGroupMetadata( - groupDescription, - applicationType, - applicationIdentifier, - globalPlacementRules ?? new ChangeTrackingList(), - volumesCount, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeGroupMetadata)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeGroupMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeGroupMetadata(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeGroupMetadata)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupMetadata.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupMetadata.cs deleted file mode 100644 index c3b20d30e389..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupMetadata.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Volume group properties. - public partial class NetAppVolumeGroupMetadata - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumeGroupMetadata() - { - GlobalPlacementRules = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Group Description. - /// Application Type. - /// Application specific identifier. - /// Application specific placement rules for the volume group. - /// Number of volumes in volume group. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeGroupMetadata(string groupDescription, NetAppApplicationType? applicationType, string applicationIdentifier, IList globalPlacementRules, long? volumesCount, IDictionary serializedAdditionalRawData) - { - GroupDescription = groupDescription; - ApplicationType = applicationType; - ApplicationIdentifier = applicationIdentifier; - GlobalPlacementRules = globalPlacementRules; - VolumesCount = volumesCount; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Group Description. - public string GroupDescription { get; set; } - /// Application Type. - public NetAppApplicationType? ApplicationType { get; set; } - /// Application specific identifier. - public string ApplicationIdentifier { get; set; } - /// Application specific placement rules for the volume group. - public IList GlobalPlacementRules { get; } - /// Number of volumes in volume group. - public long? VolumesCount { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupResult.Serialization.cs deleted file mode 100644 index 655be3336a98..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupResult.Serialization.cs +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeGroupResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeGroupResult)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Location)) - { - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location.Value); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsDefined(GroupMetaData)) - { - writer.WritePropertyName("groupMetaData"u8); - writer.WriteObjectValue(GroupMetaData, options); - } - writer.WriteEndObject(); - } - - NetAppVolumeGroupResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeGroupResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeGroupResult(document.RootElement, options); - } - - internal static NetAppVolumeGroupResult DeserializeNetAppVolumeGroupResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AzureLocation? location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string provisioningState = default; - NetAppVolumeGroupMetadata groupMetaData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("location"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("groupMetaData"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - groupMetaData = NetAppVolumeGroupMetadata.DeserializeNetAppVolumeGroupMetadata(property0.Value, options); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeGroupResult( - id, - name, - type, - systemData, - location, - provisioningState, - groupMetaData, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeGroupResult)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeGroupResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeGroupResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeGroupResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupResult.cs deleted file mode 100644 index d06b810d110f..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupResult.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Volume group resource. - public partial class NetAppVolumeGroupResult : ResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppVolumeGroupResult() - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Resource location. - /// Azure lifecycle management. - /// Volume group details. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeGroupResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string provisioningState, NetAppVolumeGroupMetadata groupMetaData, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Location = location; - ProvisioningState = provisioningState; - GroupMetaData = groupMetaData; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Resource location. - public AzureLocation? Location { get; } - /// Azure lifecycle management. - public string ProvisioningState { get; } - /// Volume group details. - public NetAppVolumeGroupMetadata GroupMetaData { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupVolume.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupVolume.Serialization.cs deleted file mode 100644 index 86d562d21ac4..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupVolume.Serialization.cs +++ /dev/null @@ -1,1286 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeGroupVolume : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeGroupVolume)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W" && Optional.IsDefined(ResourceType)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType.Value); - } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(Zones)) - { - writer.WritePropertyName("zones"u8); - writer.WriteStartArray(); - foreach (var item in Zones) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(IsRestoring)) - { - writer.WritePropertyName("isRestoring"u8); - writer.WriteBooleanValue(IsRestoring.Value); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(FileSystemId)) - { - writer.WritePropertyName("fileSystemId"u8); - writer.WriteStringValue(FileSystemId.Value); - } - writer.WritePropertyName("creationToken"u8); - writer.WriteStringValue(CreationToken); - if (Optional.IsDefined(ServiceLevel)) - { - writer.WritePropertyName("serviceLevel"u8); - writer.WriteStringValue(ServiceLevel.Value.ToString()); - } - writer.WritePropertyName("usageThreshold"u8); - writer.WriteNumberValue(UsageThreshold); - if (Optional.IsDefined(ExportPolicy)) - { - writer.WritePropertyName("exportPolicy"u8); - writer.WriteObjectValue(ExportPolicy, options); - } - if (Optional.IsCollectionDefined(ProtocolTypes)) - { - writer.WritePropertyName("protocolTypes"u8); - writer.WriteStartArray(); - foreach (var item in ProtocolTypes) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsDefined(SnapshotId)) - { - if (SnapshotId != null) - { - writer.WritePropertyName("snapshotId"u8); - writer.WriteStringValue(SnapshotId); - } - else - { - writer.WriteNull("snapshotId"); - } - } - if (Optional.IsDefined(DeleteBaseSnapshot)) - { - writer.WritePropertyName("deleteBaseSnapshot"u8); - writer.WriteBooleanValue(DeleteBaseSnapshot.Value); - } - if (Optional.IsDefined(BackupId)) - { - if (BackupId != null) - { - writer.WritePropertyName("backupId"u8); - writer.WriteStringValue(BackupId); - } - else - { - writer.WriteNull("backupId"); - } - } - if (options.Format != "W" && Optional.IsDefined(BaremetalTenantId)) - { - writer.WritePropertyName("baremetalTenantId"u8); - writer.WriteStringValue(BaremetalTenantId); - } - writer.WritePropertyName("subnetId"u8); - writer.WriteStringValue(SubnetId); - if (Optional.IsDefined(NetworkFeatures)) - { - writer.WritePropertyName("networkFeatures"u8); - writer.WriteStringValue(NetworkFeatures.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(EffectiveNetworkFeatures)) - { - writer.WritePropertyName("effectiveNetworkFeatures"u8); - writer.WriteStringValue(EffectiveNetworkFeatures.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(NetworkSiblingSetId)) - { - writer.WritePropertyName("networkSiblingSetId"u8); - writer.WriteStringValue(NetworkSiblingSetId.Value); - } - if (options.Format != "W" && Optional.IsDefined(StorageToNetworkProximity)) - { - writer.WritePropertyName("storageToNetworkProximity"u8); - writer.WriteStringValue(StorageToNetworkProximity.Value.ToString()); - } - if (options.Format != "W" && Optional.IsCollectionDefined(MountTargets)) - { - writer.WritePropertyName("mountTargets"u8); - writer.WriteStartArray(); - foreach (var item in MountTargets) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(VolumeType)) - { - writer.WritePropertyName("volumeType"u8); - writer.WriteStringValue(VolumeType); - } - if (Optional.IsDefined(DataProtection)) - { - writer.WritePropertyName("dataProtection"u8); - writer.WriteObjectValue(DataProtection, options); - } - if (Optional.IsDefined(AcceptGrowCapacityPoolForShortTermCloneSplit)) - { - writer.WritePropertyName("acceptGrowCapacityPoolForShortTermCloneSplit"u8); - writer.WriteStringValue(AcceptGrowCapacityPoolForShortTermCloneSplit.Value.ToString()); - } - if (Optional.IsDefined(IsSnapshotDirectoryVisible)) - { - writer.WritePropertyName("snapshotDirectoryVisible"u8); - writer.WriteBooleanValue(IsSnapshotDirectoryVisible.Value); - } - if (Optional.IsDefined(IsKerberosEnabled)) - { - writer.WritePropertyName("kerberosEnabled"u8); - writer.WriteBooleanValue(IsKerberosEnabled.Value); - } - if (Optional.IsDefined(SecurityStyle)) - { - writer.WritePropertyName("securityStyle"u8); - writer.WriteStringValue(SecurityStyle.Value.ToString()); - } - if (Optional.IsDefined(IsSmbEncryptionEnabled)) - { - writer.WritePropertyName("smbEncryption"u8); - writer.WriteBooleanValue(IsSmbEncryptionEnabled.Value); - } - if (Optional.IsDefined(SmbAccessBasedEnumeration)) - { - if (SmbAccessBasedEnumeration != null) - { - writer.WritePropertyName("smbAccessBasedEnumeration"u8); - writer.WriteStringValue(SmbAccessBasedEnumeration.Value.ToString()); - } - else - { - writer.WriteNull("smbAccessBasedEnumeration"); - } - } - if (Optional.IsDefined(SmbNonBrowsable)) - { - writer.WritePropertyName("smbNonBrowsable"u8); - writer.WriteStringValue(SmbNonBrowsable.Value.ToString()); - } - if (Optional.IsDefined(IsSmbContinuouslyAvailable)) - { - writer.WritePropertyName("smbContinuouslyAvailable"u8); - writer.WriteBooleanValue(IsSmbContinuouslyAvailable.Value); - } - if (Optional.IsDefined(ThroughputMibps)) - { - if (ThroughputMibps != null) - { - writer.WritePropertyName("throughputMibps"u8); - writer.WriteNumberValue(ThroughputMibps.Value); - } - else - { - writer.WriteNull("throughputMibps"); - } - } - if (options.Format != "W" && Optional.IsDefined(ActualThroughputMibps)) - { - writer.WritePropertyName("actualThroughputMibps"u8); - writer.WriteNumberValue(ActualThroughputMibps.Value); - } - if (Optional.IsDefined(EncryptionKeySource)) - { - writer.WritePropertyName("encryptionKeySource"u8); - writer.WriteStringValue(EncryptionKeySource.Value.ToString()); - } - if (Optional.IsDefined(KeyVaultPrivateEndpointResourceId)) - { - writer.WritePropertyName("keyVaultPrivateEndpointResourceId"u8); - writer.WriteStringValue(KeyVaultPrivateEndpointResourceId); - } - if (Optional.IsDefined(IsLdapEnabled)) - { - writer.WritePropertyName("ldapEnabled"u8); - writer.WriteBooleanValue(IsLdapEnabled.Value); - } - if (Optional.IsDefined(LdapServerType)) - { - if (LdapServerType != null) - { - writer.WritePropertyName("ldapServerType"u8); - writer.WriteStringValue(LdapServerType.Value.ToString()); - } - else - { - writer.WriteNull("ldapServerType"); - } - } - if (Optional.IsDefined(IsCoolAccessEnabled)) - { - writer.WritePropertyName("coolAccess"u8); - writer.WriteBooleanValue(IsCoolAccessEnabled.Value); - } - if (Optional.IsDefined(CoolnessPeriod)) - { - writer.WritePropertyName("coolnessPeriod"u8); - writer.WriteNumberValue(CoolnessPeriod.Value); - } - if (Optional.IsDefined(CoolAccessRetrievalPolicy)) - { - writer.WritePropertyName("coolAccessRetrievalPolicy"u8); - writer.WriteStringValue(CoolAccessRetrievalPolicy.Value.ToString()); - } - if (Optional.IsDefined(CoolAccessTieringPolicy)) - { - writer.WritePropertyName("coolAccessTieringPolicy"u8); - writer.WriteStringValue(CoolAccessTieringPolicy.Value.ToString()); - } - if (Optional.IsDefined(UnixPermissions)) - { - if (UnixPermissions != null) - { - writer.WritePropertyName("unixPermissions"u8); - writer.WriteStringValue(UnixPermissions); - } - else - { - writer.WriteNull("unixPermissions"); - } - } - if (options.Format != "W" && Optional.IsDefined(CloneProgress)) - { - if (CloneProgress != null) - { - writer.WritePropertyName("cloneProgress"u8); - writer.WriteNumberValue(CloneProgress.Value); - } - else - { - writer.WriteNull("cloneProgress"); - } - } - if (options.Format != "W" && Optional.IsDefined(FileAccessLogs)) - { - writer.WritePropertyName("fileAccessLogs"u8); - writer.WriteStringValue(FileAccessLogs.Value.ToString()); - } - if (Optional.IsDefined(AvsDataStore)) - { - writer.WritePropertyName("avsDataStore"u8); - writer.WriteStringValue(AvsDataStore.Value.ToString()); - } - if (options.Format != "W" && Optional.IsCollectionDefined(DataStoreResourceId)) - { - writer.WritePropertyName("dataStoreResourceId"u8); - writer.WriteStartArray(); - foreach (var item in DataStoreResourceId) - { - if (item == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(IsDefaultQuotaEnabled)) - { - writer.WritePropertyName("isDefaultQuotaEnabled"u8); - writer.WriteBooleanValue(IsDefaultQuotaEnabled.Value); - } - if (Optional.IsDefined(DefaultUserQuotaInKiBs)) - { - writer.WritePropertyName("defaultUserQuotaInKiBs"u8); - writer.WriteNumberValue(DefaultUserQuotaInKiBs.Value); - } - if (Optional.IsDefined(DefaultGroupQuotaInKiBs)) - { - writer.WritePropertyName("defaultGroupQuotaInKiBs"u8); - writer.WriteNumberValue(DefaultGroupQuotaInKiBs.Value); - } - if (options.Format != "W" && Optional.IsDefined(MaximumNumberOfFiles)) - { - writer.WritePropertyName("maximumNumberOfFiles"u8); - writer.WriteNumberValue(MaximumNumberOfFiles.Value); - } - if (options.Format != "W" && Optional.IsDefined(VolumeGroupName)) - { - writer.WritePropertyName("volumeGroupName"u8); - writer.WriteStringValue(VolumeGroupName); - } - if (Optional.IsDefined(CapacityPoolResourceId)) - { - writer.WritePropertyName("capacityPoolResourceId"u8); - writer.WriteStringValue(CapacityPoolResourceId); - } - if (Optional.IsDefined(ProximityPlacementGroupId)) - { - writer.WritePropertyName("proximityPlacementGroup"u8); - writer.WriteStringValue(ProximityPlacementGroupId); - } - if (options.Format != "W" && Optional.IsDefined(T2Network)) - { - writer.WritePropertyName("t2Network"u8); - writer.WriteStringValue(T2Network); - } - if (Optional.IsDefined(VolumeSpecName)) - { - writer.WritePropertyName("volumeSpecName"u8); - writer.WriteStringValue(VolumeSpecName); - } - if (options.Format != "W" && Optional.IsDefined(IsEncrypted)) - { - writer.WritePropertyName("encrypted"u8); - writer.WriteBooleanValue(IsEncrypted.Value); - } - if (Optional.IsCollectionDefined(PlacementRules)) - { - writer.WritePropertyName("placementRules"u8); - writer.WriteStartArray(); - foreach (var item in PlacementRules) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(EnableSubvolumes)) - { - writer.WritePropertyName("enableSubvolumes"u8); - writer.WriteStringValue(EnableSubvolumes.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(ProvisionedAvailabilityZone)) - { - if (ProvisionedAvailabilityZone != null) - { - writer.WritePropertyName("provisionedAvailabilityZone"u8); - writer.WriteStringValue(ProvisionedAvailabilityZone); - } - else - { - writer.WriteNull("provisionedAvailabilityZone"); - } - } - if (Optional.IsDefined(IsLargeVolume)) - { - writer.WritePropertyName("isLargeVolume"u8); - writer.WriteBooleanValue(IsLargeVolume.Value); - } - if (options.Format != "W" && Optional.IsDefined(OriginatingResourceId)) - { - if (OriginatingResourceId != null) - { - writer.WritePropertyName("originatingResourceId"u8); - writer.WriteStringValue(OriginatingResourceId); - } - else - { - writer.WriteNull("originatingResourceId"); - } - } - if (options.Format != "W" && Optional.IsDefined(InheritedSizeInBytes)) - { - if (InheritedSizeInBytes != null) - { - writer.WritePropertyName("inheritedSizeInBytes"u8); - writer.WriteNumberValue(InheritedSizeInBytes.Value); - } - else - { - writer.WriteNull("inheritedSizeInBytes"); - } - } - if (Optional.IsDefined(Language)) - { - if (Language != null) - { - writer.WritePropertyName("language"u8); - writer.WriteStringValue(Language.Value.ToString()); - } - else - { - writer.WriteNull("language"); - } - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeGroupVolume IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeGroupVolume)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeGroupVolume(document.RootElement, options); - } - - internal static NetAppVolumeGroupVolume DeserializeNetAppVolumeGroupVolume(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType? type = default; - IDictionary tags = default; - IList zones = default; - bool? isRestoring = default; - Guid? fileSystemId = default; - string creationToken = default; - NetAppFileServiceLevel? serviceLevel = default; - long usageThreshold = default; - VolumePropertiesExportPolicy exportPolicy = default; - IList protocolTypes = default; - string provisioningState = default; - string snapshotId = default; - bool? deleteBaseSnapshot = default; - string backupId = default; - string baremetalTenantId = default; - ResourceIdentifier subnetId = default; - NetAppNetworkFeature? networkFeatures = default; - NetAppNetworkFeature? effectiveNetworkFeatures = default; - Guid? networkSiblingSetId = default; - NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity = default; - IReadOnlyList mountTargets = default; - string volumeType = default; - NetAppVolumeDataProtection dataProtection = default; - AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit = default; - bool? snapshotDirectoryVisible = default; - bool? kerberosEnabled = default; - NetAppVolumeSecurityStyle? securityStyle = default; - bool? smbEncryption = default; - SmbAccessBasedEnumeration? smbAccessBasedEnumeration = default; - SmbNonBrowsable? smbNonBrowsable = default; - bool? smbContinuouslyAvailable = default; - float? throughputMibps = default; - float? actualThroughputMibps = default; - NetAppEncryptionKeySource? encryptionKeySource = default; - ResourceIdentifier keyVaultPrivateEndpointResourceId = default; - bool? ldapEnabled = default; - LdapServerType? ldapServerType = default; - bool? coolAccess = default; - int? coolnessPeriod = default; - CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = default; - CoolAccessTieringPolicy? coolAccessTieringPolicy = default; - string unixPermissions = default; - int? cloneProgress = default; - NetAppFileAccessLog? fileAccessLogs = default; - NetAppAvsDataStore? avsDataStore = default; - IReadOnlyList dataStoreResourceId = default; - bool? isDefaultQuotaEnabled = default; - long? defaultUserQuotaInKiBs = default; - long? defaultGroupQuotaInKiBs = default; - long? maximumNumberOfFiles = default; - string volumeGroupName = default; - ResourceIdentifier capacityPoolResourceId = default; - ResourceIdentifier proximityPlacementGroup = default; - string t2Network = default; - string volumeSpecName = default; - bool? encrypted = default; - IList placementRules = default; - EnableNetAppSubvolume? enableSubvolumes = default; - string provisionedAvailabilityZone = default; - bool? isLargeVolume = default; - ResourceIdentifier originatingResourceId = default; - long? inheritedSizeInBytes = default; - NetAppVolumeLanguage? language = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("zones"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - zones = array; - continue; - } - if (property.NameEquals("isRestoring"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isRestoring = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("fileSystemId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fileSystemId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("creationToken"u8)) - { - creationToken = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("serviceLevel"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - serviceLevel = new NetAppFileServiceLevel(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("usageThreshold"u8)) - { - usageThreshold = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("exportPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exportPolicy = VolumePropertiesExportPolicy.DeserializeVolumePropertiesExportPolicy(property0.Value, options); - continue; - } - if (property0.NameEquals("protocolTypes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - protocolTypes = array; - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("snapshotId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - snapshotId = null; - continue; - } - snapshotId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("deleteBaseSnapshot"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - deleteBaseSnapshot = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("backupId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - backupId = null; - continue; - } - backupId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("baremetalTenantId"u8)) - { - baremetalTenantId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("subnetId"u8)) - { - subnetId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("networkFeatures"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkFeatures = new NetAppNetworkFeature(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("effectiveNetworkFeatures"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - effectiveNetworkFeatures = new NetAppNetworkFeature(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("networkSiblingSetId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkSiblingSetId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("storageToNetworkProximity"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - storageToNetworkProximity = new NetAppVolumeStorageToNetworkProximity(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("mountTargets"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(NetAppVolumeMountTarget.DeserializeNetAppVolumeMountTarget(item, options)); - } - mountTargets = array; - continue; - } - if (property0.NameEquals("volumeType"u8)) - { - volumeType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("dataProtection"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dataProtection = NetAppVolumeDataProtection.DeserializeNetAppVolumeDataProtection(property0.Value, options); - continue; - } - if (property0.NameEquals("acceptGrowCapacityPoolForShortTermCloneSplit"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - acceptGrowCapacityPoolForShortTermCloneSplit = new AcceptGrowCapacityPoolForShortTermCloneSplit(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("snapshotDirectoryVisible"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - snapshotDirectoryVisible = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("kerberosEnabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kerberosEnabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("securityStyle"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - securityStyle = new NetAppVolumeSecurityStyle(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("smbEncryption"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - smbEncryption = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("smbAccessBasedEnumeration"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - smbAccessBasedEnumeration = null; - continue; - } - smbAccessBasedEnumeration = new SmbAccessBasedEnumeration(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("smbNonBrowsable"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - smbNonBrowsable = new SmbNonBrowsable(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("smbContinuouslyAvailable"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - smbContinuouslyAvailable = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("throughputMibps"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - throughputMibps = null; - continue; - } - throughputMibps = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("actualThroughputMibps"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - actualThroughputMibps = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("encryptionKeySource"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - encryptionKeySource = new NetAppEncryptionKeySource(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("keyVaultPrivateEndpointResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultPrivateEndpointResourceId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("ldapEnabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - ldapEnabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("ldapServerType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - ldapServerType = null; - continue; - } - ldapServerType = new LdapServerType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("coolAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccess = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("coolnessPeriod"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolnessPeriod = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("coolAccessRetrievalPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccessRetrievalPolicy = new CoolAccessRetrievalPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("coolAccessTieringPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccessTieringPolicy = new CoolAccessTieringPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("unixPermissions"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - unixPermissions = null; - continue; - } - unixPermissions = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("cloneProgress"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - cloneProgress = null; - continue; - } - cloneProgress = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("fileAccessLogs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fileAccessLogs = new NetAppFileAccessLog(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("avsDataStore"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - avsDataStore = new NetAppAvsDataStore(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("dataStoreResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(new ResourceIdentifier(item.GetString())); - } - } - dataStoreResourceId = array; - continue; - } - if (property0.NameEquals("isDefaultQuotaEnabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isDefaultQuotaEnabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("defaultUserQuotaInKiBs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - defaultUserQuotaInKiBs = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("defaultGroupQuotaInKiBs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - defaultGroupQuotaInKiBs = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("maximumNumberOfFiles"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maximumNumberOfFiles = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("volumeGroupName"u8)) - { - volumeGroupName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("capacityPoolResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - capacityPoolResourceId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("proximityPlacementGroup"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - proximityPlacementGroup = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("t2Network"u8)) - { - t2Network = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("volumeSpecName"u8)) - { - volumeSpecName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("encrypted"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - encrypted = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("placementRules"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(NetAppVolumePlacementRule.DeserializeNetAppVolumePlacementRule(item, options)); - } - placementRules = array; - continue; - } - if (property0.NameEquals("enableSubvolumes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableSubvolumes = new EnableNetAppSubvolume(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisionedAvailabilityZone"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - provisionedAvailabilityZone = null; - continue; - } - provisionedAvailabilityZone = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("isLargeVolume"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isLargeVolume = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("originatingResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - originatingResourceId = null; - continue; - } - originatingResourceId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("inheritedSizeInBytes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - inheritedSizeInBytes = null; - continue; - } - inheritedSizeInBytes = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("language"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - language = null; - continue; - } - language = new NetAppVolumeLanguage(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeGroupVolume( - id, - name, - type, - tags ?? new ChangeTrackingDictionary(), - zones ?? new ChangeTrackingList(), - fileSystemId, - creationToken, - serviceLevel, - usageThreshold, - exportPolicy, - protocolTypes ?? new ChangeTrackingList(), - provisioningState, - snapshotId, - deleteBaseSnapshot, - backupId, - baremetalTenantId, - subnetId, - networkFeatures, - effectiveNetworkFeatures, - networkSiblingSetId, - storageToNetworkProximity, - mountTargets ?? new ChangeTrackingList(), - volumeType, - dataProtection, - acceptGrowCapacityPoolForShortTermCloneSplit, - isRestoring, - snapshotDirectoryVisible, - kerberosEnabled, - securityStyle, - smbEncryption, - smbAccessBasedEnumeration, - smbNonBrowsable, - smbContinuouslyAvailable, - throughputMibps, - actualThroughputMibps, - encryptionKeySource, - keyVaultPrivateEndpointResourceId, - ldapEnabled, - ldapServerType, - coolAccess, - coolnessPeriod, - coolAccessRetrievalPolicy, - coolAccessTieringPolicy, - unixPermissions, - cloneProgress, - fileAccessLogs, - avsDataStore, - dataStoreResourceId ?? new ChangeTrackingList(), - isDefaultQuotaEnabled, - defaultUserQuotaInKiBs, - defaultGroupQuotaInKiBs, - maximumNumberOfFiles, - volumeGroupName, - capacityPoolResourceId, - proximityPlacementGroup, - t2Network, - volumeSpecName, - encrypted, - placementRules ?? new ChangeTrackingList(), - enableSubvolumes, - provisionedAvailabilityZone, - isLargeVolume, - originatingResourceId, - inheritedSizeInBytes, - language, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeGroupVolume)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeGroupVolume IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeGroupVolume(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeGroupVolume)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeLanguage.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeLanguage.cs deleted file mode 100644 index ef814a5f25eb..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeLanguage.cs +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Language supported for volume. - public readonly partial struct NetAppVolumeLanguage : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppVolumeLanguage(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CUtf8Value = "c.utf-8"; - private const string Utf8Mb4Value = "utf8mb4"; - private const string ArValue = "ar"; - private const string ArUtf8Value = "ar.utf-8"; - private const string HrValue = "hr"; - private const string HrUtf8Value = "hr.utf-8"; - private const string CsValue = "cs"; - private const string CsUtf8Value = "cs.utf-8"; - private const string DaValue = "da"; - private const string DaUtf8Value = "da.utf-8"; - private const string NlValue = "nl"; - private const string NlUtf8Value = "nl.utf-8"; - private const string EnValue = "en"; - private const string EnUtf8Value = "en.utf-8"; - private const string FiValue = "fi"; - private const string FiUtf8Value = "fi.utf-8"; - private const string FrValue = "fr"; - private const string FrUtf8Value = "fr.utf-8"; - private const string DeValue = "de"; - private const string DeUtf8Value = "de.utf-8"; - private const string HeValue = "he"; - private const string HeUtf8Value = "he.utf-8"; - private const string HuValue = "hu"; - private const string HuUtf8Value = "hu.utf-8"; - private const string ItValue = "it"; - private const string ItUtf8Value = "it.utf-8"; - private const string JaValue = "ja"; - private const string JaUtf8Value = "ja.utf-8"; - private const string JaV1Value = "ja-v1"; - private const string JaV1Utf8Value = "ja-v1.utf-8"; - private const string JaJpPckValue = "ja-jp.pck"; - private const string JaJpPckUtf8Value = "ja-jp.pck.utf-8"; - private const string JaJp932Value = "ja-jp.932"; - private const string JaJp932Utf8Value = "ja-jp.932.utf-8"; - private const string JaJpPckV2Value = "ja-jp.pck-v2"; - private const string JaJpPckV2Utf8Value = "ja-jp.pck-v2.utf-8"; - private const string KoValue = "ko"; - private const string KoUtf8Value = "ko.utf-8"; - private const string NoValue = "no"; - private const string NoUtf8Value = "no.utf-8"; - private const string PlValue = "pl"; - private const string PlUtf8Value = "pl.utf-8"; - private const string PtValue = "pt"; - private const string PtUtf8Value = "pt.utf-8"; - private const string CValue = "c"; - private const string RoValue = "ro"; - private const string RoUtf8Value = "ro.utf-8"; - private const string RuValue = "ru"; - private const string RuUtf8Value = "ru.utf-8"; - private const string ZhValue = "zh"; - private const string ZhUtf8Value = "zh.utf-8"; - private const string ZhGbkValue = "zh.gbk"; - private const string ZhGbkUtf8Value = "zh.gbk.utf-8"; - private const string ZhTwBig5Value = "zh-tw.big5"; - private const string ZhTwBig5Utf8Value = "zh-tw.big5.utf-8"; - private const string ZhTwValue = "zh-tw"; - private const string ZhTwUtf8Value = "zh-tw.utf-8"; - private const string SkValue = "sk"; - private const string SkUtf8Value = "sk.utf-8"; - private const string SlValue = "sl"; - private const string SlUtf8Value = "sl.utf-8"; - private const string EsValue = "es"; - private const string EsUtf8Value = "es.utf-8"; - private const string SvValue = "sv"; - private const string SvUtf8Value = "sv.utf-8"; - private const string TrValue = "tr"; - private const string TrUtf8Value = "tr.utf-8"; - private const string EnUsValue = "en-us"; - private const string EnUsUtf8Value = "en-us.utf-8"; - - /// Posix with UTF-8. - public static NetAppVolumeLanguage CUtf8 { get; } = new NetAppVolumeLanguage(CUtf8Value); - /// UTF-8 with 4 byte character support. - public static NetAppVolumeLanguage Utf8Mb4 { get; } = new NetAppVolumeLanguage(Utf8Mb4Value); - /// Arabic - Deprecated. - public static NetAppVolumeLanguage Ar { get; } = new NetAppVolumeLanguage(ArValue); - /// Arabic with UTF-8. - public static NetAppVolumeLanguage ArUtf8 { get; } = new NetAppVolumeLanguage(ArUtf8Value); - /// Croatian - Deprecated. - public static NetAppVolumeLanguage Hr { get; } = new NetAppVolumeLanguage(HrValue); - /// Croatian with UTF-8. - public static NetAppVolumeLanguage HrUtf8 { get; } = new NetAppVolumeLanguage(HrUtf8Value); - /// Czech - Deprecated. - public static NetAppVolumeLanguage Cs { get; } = new NetAppVolumeLanguage(CsValue); - /// Czech with UTF-8. - public static NetAppVolumeLanguage CsUtf8 { get; } = new NetAppVolumeLanguage(CsUtf8Value); - /// Danish - Deprecated. - public static NetAppVolumeLanguage Da { get; } = new NetAppVolumeLanguage(DaValue); - /// Danish with UTF-8. - public static NetAppVolumeLanguage DaUtf8 { get; } = new NetAppVolumeLanguage(DaUtf8Value); - /// Dutch - Deprecated. - public static NetAppVolumeLanguage Nl { get; } = new NetAppVolumeLanguage(NlValue); - /// Dutch with UTF-8. - public static NetAppVolumeLanguage NlUtf8 { get; } = new NetAppVolumeLanguage(NlUtf8Value); - /// English - Deprecated. - public static NetAppVolumeLanguage En { get; } = new NetAppVolumeLanguage(EnValue); - /// English with UTF-8. - public static NetAppVolumeLanguage EnUtf8 { get; } = new NetAppVolumeLanguage(EnUtf8Value); - /// Finnish - Deprecated. - public static NetAppVolumeLanguage Fi { get; } = new NetAppVolumeLanguage(FiValue); - /// Finnish with UTF-8. - public static NetAppVolumeLanguage FiUtf8 { get; } = new NetAppVolumeLanguage(FiUtf8Value); - /// French - Deprecated. - public static NetAppVolumeLanguage Fr { get; } = new NetAppVolumeLanguage(FrValue); - /// French with UTF-8. - public static NetAppVolumeLanguage FrUtf8 { get; } = new NetAppVolumeLanguage(FrUtf8Value); - /// German - Deprecated. - public static NetAppVolumeLanguage De { get; } = new NetAppVolumeLanguage(DeValue); - /// German with UTF-8. - public static NetAppVolumeLanguage DeUtf8 { get; } = new NetAppVolumeLanguage(DeUtf8Value); - /// Hebrew - Deprecated. - public static NetAppVolumeLanguage He { get; } = new NetAppVolumeLanguage(HeValue); - /// Hebrew with UTF-8. - public static NetAppVolumeLanguage HeUtf8 { get; } = new NetAppVolumeLanguage(HeUtf8Value); - /// Hungarian - Deprecated. - public static NetAppVolumeLanguage Hu { get; } = new NetAppVolumeLanguage(HuValue); - /// Hungarian with UTF-8. - public static NetAppVolumeLanguage HuUtf8 { get; } = new NetAppVolumeLanguage(HuUtf8Value); - /// Italian - Deprecated. - public static NetAppVolumeLanguage It { get; } = new NetAppVolumeLanguage(ItValue); - /// Italian with UTF-8. - public static NetAppVolumeLanguage ItUtf8 { get; } = new NetAppVolumeLanguage(ItUtf8Value); - /// Japanese euc-j - Deprecated. - public static NetAppVolumeLanguage Ja { get; } = new NetAppVolumeLanguage(JaValue); - /// Japanese euc-j with UTF-8. - public static NetAppVolumeLanguage JaUtf8 { get; } = new NetAppVolumeLanguage(JaUtf8Value); - /// Japanese euc-j - Deprecated. - public static NetAppVolumeLanguage JaV1 { get; } = new NetAppVolumeLanguage(JaV1Value); - /// Japanese euc-j with UTF-8. - public static NetAppVolumeLanguage JaV1Utf8 { get; } = new NetAppVolumeLanguage(JaV1Utf8Value); - /// Japanese pck. - public static NetAppVolumeLanguage JaJpPck { get; } = new NetAppVolumeLanguage(JaJpPckValue); - /// Japanese pck with UTF-8 - Deprecated. - public static NetAppVolumeLanguage JaJpPckUtf8 { get; } = new NetAppVolumeLanguage(JaJpPckUtf8Value); - /// Japanese cp932. - public static NetAppVolumeLanguage JaJp932 { get; } = new NetAppVolumeLanguage(JaJp932Value); - /// Japanese cp932 with UTF-8 - Deprecated. - public static NetAppVolumeLanguage JaJp932Utf8 { get; } = new NetAppVolumeLanguage(JaJp932Utf8Value); - /// Japanese pck - sjis. - public static NetAppVolumeLanguage JaJpPckV2 { get; } = new NetAppVolumeLanguage(JaJpPckV2Value); - /// Japanese pck - sjis with UTF-8 - Deprecated. - public static NetAppVolumeLanguage JaJpPckV2Utf8 { get; } = new NetAppVolumeLanguage(JaJpPckV2Utf8Value); - /// Korean - Deprecated. - public static NetAppVolumeLanguage Ko { get; } = new NetAppVolumeLanguage(KoValue); - /// Korean with UTF-8. - public static NetAppVolumeLanguage KoUtf8 { get; } = new NetAppVolumeLanguage(KoUtf8Value); - /// Norwegian - Deprecated. - public static NetAppVolumeLanguage No { get; } = new NetAppVolumeLanguage(NoValue); - /// Norwegian with UTF-8. - public static NetAppVolumeLanguage NoUtf8 { get; } = new NetAppVolumeLanguage(NoUtf8Value); - /// Polish - Deprecated. - public static NetAppVolumeLanguage Pl { get; } = new NetAppVolumeLanguage(PlValue); - /// Polish with UTF-8. - public static NetAppVolumeLanguage PlUtf8 { get; } = new NetAppVolumeLanguage(PlUtf8Value); - /// Portuguese - Deprecated. - public static NetAppVolumeLanguage Pt { get; } = new NetAppVolumeLanguage(PtValue); - /// Portuguese with UTF-8. - public static NetAppVolumeLanguage PtUtf8 { get; } = new NetAppVolumeLanguage(PtUtf8Value); - /// Posix - Deprecated. - public static NetAppVolumeLanguage C { get; } = new NetAppVolumeLanguage(CValue); - /// Romanian - Deprecated. - public static NetAppVolumeLanguage Ro { get; } = new NetAppVolumeLanguage(RoValue); - /// Romanian with UTF-8. - public static NetAppVolumeLanguage RoUtf8 { get; } = new NetAppVolumeLanguage(RoUtf8Value); - /// Russian - Deprecated. - public static NetAppVolumeLanguage Ru { get; } = new NetAppVolumeLanguage(RuValue); - /// Russian with UTF-8. - public static NetAppVolumeLanguage RuUtf8 { get; } = new NetAppVolumeLanguage(RuUtf8Value); - /// Simplified Chinese - Deprecated. - public static NetAppVolumeLanguage Zh { get; } = new NetAppVolumeLanguage(ZhValue); - /// Simplified Chinese with UTF-8. - public static NetAppVolumeLanguage ZhUtf8 { get; } = new NetAppVolumeLanguage(ZhUtf8Value); - /// Simplified gbk Chinese. - public static NetAppVolumeLanguage ZhGbk { get; } = new NetAppVolumeLanguage(ZhGbkValue); - /// Simplified gbk Chinese with UTF-8 - Deprecated. - public static NetAppVolumeLanguage ZhGbkUtf8 { get; } = new NetAppVolumeLanguage(ZhGbkUtf8Value); - /// Traditional Chinese BIG 5. - public static NetAppVolumeLanguage ZhTwBig5 { get; } = new NetAppVolumeLanguage(ZhTwBig5Value); - /// Traditional Chinese BIG 5 with UTF-8 - Deprecated. - public static NetAppVolumeLanguage ZhTwBig5Utf8 { get; } = new NetAppVolumeLanguage(ZhTwBig5Utf8Value); - /// Traditional Chinese EUC-TW. - public static NetAppVolumeLanguage ZhTw { get; } = new NetAppVolumeLanguage(ZhTwValue); - /// Traditional Chinese EUC-TW with UTF-8 - Deprecated. - public static NetAppVolumeLanguage ZhTwUtf8 { get; } = new NetAppVolumeLanguage(ZhTwUtf8Value); - /// Slovak - Deprecated. - public static NetAppVolumeLanguage Sk { get; } = new NetAppVolumeLanguage(SkValue); - /// Slovak with UTF-8. - public static NetAppVolumeLanguage SkUtf8 { get; } = new NetAppVolumeLanguage(SkUtf8Value); - /// Slovenian - Deprecated. - public static NetAppVolumeLanguage Sl { get; } = new NetAppVolumeLanguage(SlValue); - /// Slovenian with UTF-8. - public static NetAppVolumeLanguage SlUtf8 { get; } = new NetAppVolumeLanguage(SlUtf8Value); - /// Spanish - Deprecated. - public static NetAppVolumeLanguage Es { get; } = new NetAppVolumeLanguage(EsValue); - /// Spanish with UTF-8. - public static NetAppVolumeLanguage EsUtf8 { get; } = new NetAppVolumeLanguage(EsUtf8Value); - /// Swedish - Deprecated. - public static NetAppVolumeLanguage Sv { get; } = new NetAppVolumeLanguage(SvValue); - /// Swedish with UTF-8. - public static NetAppVolumeLanguage SvUtf8 { get; } = new NetAppVolumeLanguage(SvUtf8Value); - /// Turkish - Deprecated. - public static NetAppVolumeLanguage Tr { get; } = new NetAppVolumeLanguage(TrValue); - /// Turkish with UTF-8. - public static NetAppVolumeLanguage TrUtf8 { get; } = new NetAppVolumeLanguage(TrUtf8Value); - /// US English - Deprecated. - public static NetAppVolumeLanguage EnUs { get; } = new NetAppVolumeLanguage(EnUsValue); - /// US English with UTF-8. - public static NetAppVolumeLanguage EnUsUtf8 { get; } = new NetAppVolumeLanguage(EnUsUtf8Value); - /// Determines if two values are the same. - public static bool operator ==(NetAppVolumeLanguage left, NetAppVolumeLanguage right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppVolumeLanguage left, NetAppVolumeLanguage right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppVolumeLanguage(string value) => new NetAppVolumeLanguage(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppVolumeLanguage other && Equals(other); - /// - public bool Equals(NetAppVolumeLanguage other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeMountTarget.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeMountTarget.Serialization.cs deleted file mode 100644 index f84c5cf61c52..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeMountTarget.Serialization.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Net; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeMountTarget : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeMountTarget)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsDefined(MountTargetId)) - { - writer.WritePropertyName("mountTargetId"u8); - writer.WriteStringValue(MountTargetId.Value); - } - writer.WritePropertyName("fileSystemId"u8); - writer.WriteStringValue(FileSystemId); - if (options.Format != "W" && Optional.IsDefined(IPAddress)) - { - writer.WritePropertyName("ipAddress"u8); - writer.WriteStringValue(IPAddress.ToString()); - } - if (Optional.IsDefined(SmbServerFqdn)) - { - writer.WritePropertyName("smbServerFqdn"u8); - writer.WriteStringValue(SmbServerFqdn); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeMountTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeMountTarget)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeMountTarget(document.RootElement, options); - } - - internal static NetAppVolumeMountTarget DeserializeNetAppVolumeMountTarget(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Guid? mountTargetId = default; - Guid fileSystemId = default; - IPAddress ipAddress = default; - string smbServerFqdn = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("mountTargetId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mountTargetId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("fileSystemId"u8)) - { - fileSystemId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("ipAddress"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - ipAddress = IPAddress.Parse(property.Value.GetString()); - continue; - } - if (property.NameEquals("smbServerFqdn"u8)) - { - smbServerFqdn = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeMountTarget(mountTargetId, fileSystemId, ipAddress, smbServerFqdn, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeMountTarget)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeMountTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeMountTarget(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeMountTarget)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeMountTarget.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeMountTarget.cs deleted file mode 100644 index 373129941bc6..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeMountTarget.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Net; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Mount target properties. - public partial class NetAppVolumeMountTarget - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// UUID v4 used to identify the MountTarget. - internal NetAppVolumeMountTarget(Guid fileSystemId) - { - FileSystemId = fileSystemId; - } - - /// Initializes a new instance of . - /// UUID v4 used to identify the MountTarget. - /// UUID v4 used to identify the MountTarget. - /// The mount target's IPv4 address. - /// The SMB server's Fully Qualified Domain Name, FQDN. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeMountTarget(Guid? mountTargetId, Guid fileSystemId, IPAddress ipAddress, string smbServerFqdn, IDictionary serializedAdditionalRawData) - { - MountTargetId = mountTargetId; - FileSystemId = fileSystemId; - IPAddress = ipAddress; - SmbServerFqdn = smbServerFqdn; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppVolumeMountTarget() - { - } - - /// UUID v4 used to identify the MountTarget. - public Guid? MountTargetId { get; } - /// UUID v4 used to identify the MountTarget. - public Guid FileSystemId { get; } - /// The mount target's IPv4 address. - public IPAddress IPAddress { get; } - /// The SMB server's Fully Qualified Domain Name, FQDN. - public string SmbServerFqdn { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatch.Serialization.cs deleted file mode 100644 index a22fe44236c6..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatch.Serialization.cs +++ /dev/null @@ -1,475 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumePatch : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumePatch)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(ServiceLevel)) - { - writer.WritePropertyName("serviceLevel"u8); - writer.WriteStringValue(ServiceLevel.Value.ToString()); - } - if (Optional.IsDefined(UsageThreshold)) - { - writer.WritePropertyName("usageThreshold"u8); - writer.WriteNumberValue(UsageThreshold.Value); - } - if (Optional.IsDefined(ExportPolicy)) - { - writer.WritePropertyName("exportPolicy"u8); - writer.WriteObjectValue(ExportPolicy, options); - } - if (Optional.IsCollectionDefined(ProtocolTypes)) - { - writer.WritePropertyName("protocolTypes"u8); - writer.WriteStartArray(); - foreach (var item in ProtocolTypes) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ThroughputMibps)) - { - writer.WritePropertyName("throughputMibps"u8); - writer.WriteNumberValue(ThroughputMibps.Value); - } - if (Optional.IsDefined(DataProtection)) - { - writer.WritePropertyName("dataProtection"u8); - writer.WriteObjectValue(DataProtection, options); - } - if (Optional.IsDefined(IsDefaultQuotaEnabled)) - { - writer.WritePropertyName("isDefaultQuotaEnabled"u8); - writer.WriteBooleanValue(IsDefaultQuotaEnabled.Value); - } - if (Optional.IsDefined(DefaultUserQuotaInKiBs)) - { - writer.WritePropertyName("defaultUserQuotaInKiBs"u8); - writer.WriteNumberValue(DefaultUserQuotaInKiBs.Value); - } - if (Optional.IsDefined(DefaultGroupQuotaInKiBs)) - { - writer.WritePropertyName("defaultGroupQuotaInKiBs"u8); - writer.WriteNumberValue(DefaultGroupQuotaInKiBs.Value); - } - if (Optional.IsDefined(UnixPermissions)) - { - if (UnixPermissions != null) - { - writer.WritePropertyName("unixPermissions"u8); - writer.WriteStringValue(UnixPermissions); - } - else - { - writer.WriteNull("unixPermissions"); - } - } - if (Optional.IsDefined(IsCoolAccessEnabled)) - { - writer.WritePropertyName("coolAccess"u8); - writer.WriteBooleanValue(IsCoolAccessEnabled.Value); - } - if (Optional.IsDefined(CoolnessPeriod)) - { - writer.WritePropertyName("coolnessPeriod"u8); - writer.WriteNumberValue(CoolnessPeriod.Value); - } - if (Optional.IsDefined(CoolAccessRetrievalPolicy)) - { - writer.WritePropertyName("coolAccessRetrievalPolicy"u8); - writer.WriteStringValue(CoolAccessRetrievalPolicy.Value.ToString()); - } - if (Optional.IsDefined(CoolAccessTieringPolicy)) - { - writer.WritePropertyName("coolAccessTieringPolicy"u8); - writer.WriteStringValue(CoolAccessTieringPolicy.Value.ToString()); - } - if (Optional.IsDefined(IsSnapshotDirectoryVisible)) - { - writer.WritePropertyName("snapshotDirectoryVisible"u8); - writer.WriteBooleanValue(IsSnapshotDirectoryVisible.Value); - } - if (Optional.IsDefined(SmbAccessBasedEnumeration)) - { - if (SmbAccessBasedEnumeration != null) - { - writer.WritePropertyName("smbAccessBasedEnumeration"u8); - writer.WriteStringValue(SmbAccessBasedEnumeration.Value.ToString()); - } - else - { - writer.WriteNull("smbAccessBasedEnumeration"); - } - } - if (Optional.IsDefined(SmbNonBrowsable)) - { - writer.WritePropertyName("smbNonBrowsable"u8); - writer.WriteStringValue(SmbNonBrowsable.Value.ToString()); - } - writer.WriteEndObject(); - } - - NetAppVolumePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumePatch)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumePatch(document.RootElement, options); - } - - internal static NetAppVolumePatch DeserializeNetAppVolumePatch(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - NetAppFileServiceLevel? serviceLevel = default; - long? usageThreshold = default; - VolumePatchPropertiesExportPolicy exportPolicy = default; - IList protocolTypes = default; - float? throughputMibps = default; - NetAppVolumePatchDataProtection dataProtection = default; - bool? isDefaultQuotaEnabled = default; - long? defaultUserQuotaInKiBs = default; - long? defaultGroupQuotaInKiBs = default; - string unixPermissions = default; - bool? coolAccess = default; - int? coolnessPeriod = default; - CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = default; - CoolAccessTieringPolicy? coolAccessTieringPolicy = default; - bool? snapshotDirectoryVisible = default; - SmbAccessBasedEnumeration? smbAccessBasedEnumeration = default; - SmbNonBrowsable? smbNonBrowsable = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("serviceLevel"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - serviceLevel = new NetAppFileServiceLevel(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("usageThreshold"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - usageThreshold = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("exportPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exportPolicy = VolumePatchPropertiesExportPolicy.DeserializeVolumePatchPropertiesExportPolicy(property0.Value, options); - continue; - } - if (property0.NameEquals("protocolTypes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - protocolTypes = array; - continue; - } - if (property0.NameEquals("throughputMibps"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - throughputMibps = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("dataProtection"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dataProtection = NetAppVolumePatchDataProtection.DeserializeNetAppVolumePatchDataProtection(property0.Value, options); - continue; - } - if (property0.NameEquals("isDefaultQuotaEnabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isDefaultQuotaEnabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("defaultUserQuotaInKiBs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - defaultUserQuotaInKiBs = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("defaultGroupQuotaInKiBs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - defaultGroupQuotaInKiBs = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("unixPermissions"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - unixPermissions = null; - continue; - } - unixPermissions = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("coolAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccess = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("coolnessPeriod"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolnessPeriod = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("coolAccessRetrievalPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccessRetrievalPolicy = new CoolAccessRetrievalPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("coolAccessTieringPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccessTieringPolicy = new CoolAccessTieringPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("snapshotDirectoryVisible"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - snapshotDirectoryVisible = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("smbAccessBasedEnumeration"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - smbAccessBasedEnumeration = null; - continue; - } - smbAccessBasedEnumeration = new SmbAccessBasedEnumeration(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("smbNonBrowsable"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - smbNonBrowsable = new SmbNonBrowsable(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumePatch( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - serviceLevel, - usageThreshold, - exportPolicy, - protocolTypes ?? new ChangeTrackingList(), - throughputMibps, - dataProtection, - isDefaultQuotaEnabled, - defaultUserQuotaInKiBs, - defaultGroupQuotaInKiBs, - unixPermissions, - coolAccess, - coolnessPeriod, - coolAccessRetrievalPolicy, - coolAccessTieringPolicy, - snapshotDirectoryVisible, - smbAccessBasedEnumeration, - smbNonBrowsable, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumePatch)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumePatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumePatch)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatchDataProtection.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatchDataProtection.Serialization.cs deleted file mode 100644 index 0312918dae21..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatchDataProtection.Serialization.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumePatchDataProtection : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumePatchDataProtection)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Backup)) - { - writer.WritePropertyName("backup"u8); - writer.WriteObjectValue(Backup, options); - } - if (Optional.IsDefined(Snapshot)) - { - writer.WritePropertyName("snapshot"u8); - writer.WriteObjectValue(Snapshot, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumePatchDataProtection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumePatchDataProtection)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumePatchDataProtection(document.RootElement, options); - } - - internal static NetAppVolumePatchDataProtection DeserializeNetAppVolumePatchDataProtection(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - NetAppVolumeBackupConfiguration backup = default; - VolumeSnapshotProperties snapshot = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("backup"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - backup = NetAppVolumeBackupConfiguration.DeserializeNetAppVolumeBackupConfiguration(property.Value, options); - continue; - } - if (property.NameEquals("snapshot"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - snapshot = VolumeSnapshotProperties.DeserializeVolumeSnapshotProperties(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumePatchDataProtection(backup, snapshot, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumePatchDataProtection)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumePatchDataProtection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumePatchDataProtection(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumePatchDataProtection)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatchDataProtection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatchDataProtection.cs deleted file mode 100644 index 7e16cbc108a4..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatchDataProtection.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// DataProtection type volumes include an object containing details of the replication. - public partial class NetAppVolumePatchDataProtection - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumePatchDataProtection() - { - } - - /// Initializes a new instance of . - /// Backup Properties. - /// Snapshot properties. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumePatchDataProtection(NetAppVolumeBackupConfiguration backup, VolumeSnapshotProperties snapshot, IDictionary serializedAdditionalRawData) - { - Backup = backup; - Snapshot = snapshot; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Backup Properties. - public NetAppVolumeBackupConfiguration Backup { get; set; } - /// Snapshot properties. - internal VolumeSnapshotProperties Snapshot { get; set; } - /// Snapshot Policy ResourceId. - public ResourceIdentifier SnapshotPolicyId - { - get => Snapshot is null ? default : Snapshot.SnapshotPolicyId; - set - { - if (Snapshot is null) - Snapshot = new VolumeSnapshotProperties(); - Snapshot.SnapshotPolicyId = value; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePlacementRule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePlacementRule.Serialization.cs index 05e57c61d364..0308ddf6cdff 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePlacementRule.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePlacementRule.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class NetAppVolumePlacementRule : IUtf8JsonSerializable, IJsonModel + /// Application specific parameters for the placement of volumes in the volume group. + public partial class NetAppVolumePlacementRule : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal NetAppVolumePlacementRule() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,25 +34,24 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppVolumePlacementRule)} does not support writing '{format}' format."); } - writer.WritePropertyName("key"u8); writer.WriteStringValue(Key); writer.WritePropertyName("value"u8); writer.WriteStringValue(Value); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -55,55 +60,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NetAppVolumePlacementRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + NetAppVolumePlacementRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NetAppVolumePlacementRule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppVolumePlacementRule)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeNetAppVolumePlacementRule(document.RootElement, options); } - internal static NetAppVolumePlacementRule DeserializeNetAppVolumePlacementRule(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NetAppVolumePlacementRule DeserializeNetAppVolumePlacementRule(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string key = default; string value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("key"u8)) + if (prop.NameEquals("key"u8)) { - key = property.Value.GetString(); + key = prop.Value.GetString(); continue; } - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - value = property.Value.GetString(); + value = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumePlacementRule(key, value, serializedAdditionalRawData); + return new NetAppVolumePlacementRule(key, value, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -113,15 +124,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - NetAppVolumePlacementRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + NetAppVolumePlacementRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NetAppVolumePlacementRule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeNetAppVolumePlacementRule(document.RootElement, options); } default: @@ -129,6 +145,7 @@ NetAppVolumePlacementRule IPersistableModel.Create(Bi } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePlacementRule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePlacementRule.cs index 7a8fa4c99b93..1cb7643bd97c 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePlacementRule.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePlacementRule.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Application specific parameters for the placement of volumes in the volume group. public partial class NetAppVolumePlacementRule { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Key for an application specific parameter for the placement of volumes in the volume group. @@ -61,21 +33,17 @@ public NetAppVolumePlacementRule(string key, string value) /// Initializes a new instance of . /// Key for an application specific parameter for the placement of volumes in the volume group. /// Value for an application specific parameter for the placement of volumes in the volume group. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumePlacementRule(string key, string value, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal NetAppVolumePlacementRule(string key, string value, IDictionary additionalBinaryDataProperties) { Key = key; Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppVolumePlacementRule() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Key for an application specific parameter for the placement of volumes in the volume group. public string Key { get; set; } + /// Value for an application specific parameter for the placement of volumes in the volume group. public string Value { get; set; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePoolChangeContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePoolChangeContent.Serialization.cs deleted file mode 100644 index e54ecab9ea5a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePoolChangeContent.Serialization.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumePoolChangeContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumePoolChangeContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("newPoolResourceId"u8); - writer.WriteStringValue(NewPoolResourceId); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumePoolChangeContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumePoolChangeContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumePoolChangeContent(document.RootElement, options); - } - - internal static NetAppVolumePoolChangeContent DeserializeNetAppVolumePoolChangeContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier newPoolResourceId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("newPoolResourceId"u8)) - { - newPoolResourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumePoolChangeContent(newPoolResourceId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumePoolChangeContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumePoolChangeContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumePoolChangeContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumePoolChangeContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePoolChangeContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePoolChangeContent.cs deleted file mode 100644 index 07ad52c68dd8..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePoolChangeContent.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Pool change request. - public partial class NetAppVolumePoolChangeContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Resource id of the pool to move volume to. - /// is null. - public NetAppVolumePoolChangeContent(ResourceIdentifier newPoolResourceId) - { - Argument.AssertNotNull(newPoolResourceId, nameof(newPoolResourceId)); - - NewPoolResourceId = newPoolResourceId; - } - - /// Initializes a new instance of . - /// Resource id of the pool to move volume to. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumePoolChangeContent(ResourceIdentifier newPoolResourceId, IDictionary serializedAdditionalRawData) - { - NewPoolResourceId = newPoolResourceId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppVolumePoolChangeContent() - { - } - - /// Resource id of the pool to move volume to. - public ResourceIdentifier NewPoolResourceId { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReport.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReport.Serialization.cs deleted file mode 100644 index 85434db3d87c..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReport.Serialization.cs +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeQuotaReport : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeQuotaReport)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(QuotaType)) - { - writer.WritePropertyName("quotaType"u8); - writer.WriteStringValue(QuotaType.Value.ToString()); - } - if (Optional.IsDefined(QuotaTarget)) - { - writer.WritePropertyName("quotaTarget"u8); - writer.WriteStringValue(QuotaTarget); - } - if (Optional.IsDefined(QuotaLimitUsedInKiBs)) - { - writer.WritePropertyName("quotaLimitUsedInKiBs"u8); - writer.WriteNumberValue(QuotaLimitUsedInKiBs.Value); - } - if (Optional.IsDefined(QuotaLimitTotalInKiBs)) - { - writer.WritePropertyName("quotaLimitTotalInKiBs"u8); - writer.WriteNumberValue(QuotaLimitTotalInKiBs.Value); - } - if (Optional.IsDefined(PercentageUsed)) - { - writer.WritePropertyName("percentageUsed"u8); - writer.WriteNumberValue(PercentageUsed.Value); - } - if (Optional.IsDefined(IsDerivedQuota)) - { - writer.WritePropertyName("isDerivedQuota"u8); - writer.WriteBooleanValue(IsDerivedQuota.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeQuotaReport IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeQuotaReport)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeQuotaReport(document.RootElement, options); - } - - internal static NetAppVolumeQuotaReport DeserializeNetAppVolumeQuotaReport(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - NetAppVolumeQuotaType? quotaType = default; - string quotaTarget = default; - long? quotaLimitUsedInKiBs = default; - long? quotaLimitTotalInKiBs = default; - float? percentageUsed = default; - bool? isDerivedQuota = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("quotaType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - quotaType = new NetAppVolumeQuotaType(property.Value.GetString()); - continue; - } - if (property.NameEquals("quotaTarget"u8)) - { - quotaTarget = property.Value.GetString(); - continue; - } - if (property.NameEquals("quotaLimitUsedInKiBs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - quotaLimitUsedInKiBs = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("quotaLimitTotalInKiBs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - quotaLimitTotalInKiBs = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("percentageUsed"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - percentageUsed = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("isDerivedQuota"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isDerivedQuota = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeQuotaReport( - quotaType, - quotaTarget, - quotaLimitUsedInKiBs, - quotaLimitTotalInKiBs, - percentageUsed, - isDerivedQuota, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeQuotaReport)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeQuotaReport IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeQuotaReport(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeQuotaReport)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReportListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReportListResult.Serialization.cs deleted file mode 100644 index a4d5ac234858..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReportListResult.Serialization.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeQuotaReportListResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeQuotaReportListResult)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Value)) - { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeQuotaReportListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeQuotaReportListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeQuotaReportListResult(document.RootElement, options); - } - - internal static NetAppVolumeQuotaReportListResult DeserializeNetAppVolumeQuotaReportListResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(NetAppVolumeQuotaReport.DeserializeNetAppVolumeQuotaReport(item, options)); - } - value = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeQuotaReportListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeQuotaReportListResult)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeQuotaReportListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeQuotaReportListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeQuotaReportListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReportListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReportListResult.cs deleted file mode 100644 index 2ad18d6a68a9..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReportListResult.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Quota Report for volume. - public partial class NetAppVolumeQuotaReportListResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppVolumeQuotaReportListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// List of volume quota report records. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeQuotaReportListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) - { - Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// List of volume quota report records. - public IReadOnlyList Value { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaRulePatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaRulePatch.Serialization.cs deleted file mode 100644 index cd7d1d8ae2d0..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaRulePatch.Serialization.cs +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeQuotaRulePatch : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeQuotaRulePatch)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToSerialString()); - } - if (Optional.IsDefined(QuotaSizeInKiBs)) - { - writer.WritePropertyName("quotaSizeInKiBs"u8); - writer.WriteNumberValue(QuotaSizeInKiBs.Value); - } - if (Optional.IsDefined(QuotaType)) - { - writer.WritePropertyName("quotaType"u8); - writer.WriteStringValue(QuotaType.Value.ToString()); - } - if (Optional.IsDefined(QuotaTarget)) - { - writer.WritePropertyName("quotaTarget"u8); - writer.WriteStringValue(QuotaTarget); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeQuotaRulePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeQuotaRulePatch)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeQuotaRulePatch(document.RootElement, options); - } - - internal static NetAppVolumeQuotaRulePatch DeserializeNetAppVolumeQuotaRulePatch(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IDictionary tags = default; - NetAppProvisioningState? provisioningState = default; - long? quotaSizeInKiBs = default; - NetAppVolumeQuotaType? quotaType = default; - string quotaTarget = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = property0.Value.GetString().ToNetAppProvisioningState(); - continue; - } - if (property0.NameEquals("quotaSizeInKiBs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - quotaSizeInKiBs = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("quotaType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - quotaType = new NetAppVolumeQuotaType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("quotaTarget"u8)) - { - quotaTarget = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeQuotaRulePatch( - tags ?? new ChangeTrackingDictionary(), - provisioningState, - quotaSizeInKiBs, - quotaType, - quotaTarget, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeQuotaRulePatch)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeQuotaRulePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeQuotaRulePatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeQuotaRulePatch)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaRulePatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaRulePatch.cs deleted file mode 100644 index 5fbaccaf2e2b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaRulePatch.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Patchable Quota Rule of a Volume. - public partial class NetAppVolumeQuotaRulePatch - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumeQuotaRulePatch() - { - Tags = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// Resource tags. - /// Provisioning state of the resource. - /// Size of quota. - /// Type of quota. - /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeQuotaRulePatch(IDictionary tags, NetAppProvisioningState? provisioningState, long? quotaSizeInKiBs, NetAppVolumeQuotaType? quotaType, string quotaTarget, IDictionary serializedAdditionalRawData) - { - Tags = tags; - ProvisioningState = provisioningState; - QuotaSizeInKiBs = quotaSizeInKiBs; - QuotaType = quotaType; - QuotaTarget = quotaTarget; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Resource tags. - public IDictionary Tags { get; } - /// Provisioning state of the resource. - public NetAppProvisioningState? ProvisioningState { get; } - /// Size of quota. - public long? QuotaSizeInKiBs { get; set; } - /// Type of quota. - public NetAppVolumeQuotaType? QuotaType { get; set; } - /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. - public string QuotaTarget { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaType.cs deleted file mode 100644 index 99e103054a0b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaType.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Type of quota rule. - public readonly partial struct NetAppVolumeQuotaType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppVolumeQuotaType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DefaultUserQuotaValue = "DefaultUserQuota"; - private const string DefaultGroupQuotaValue = "DefaultGroupQuota"; - private const string IndividualUserQuotaValue = "IndividualUserQuota"; - private const string IndividualGroupQuotaValue = "IndividualGroupQuota"; - - /// Default user quota. - public static NetAppVolumeQuotaType DefaultUserQuota { get; } = new NetAppVolumeQuotaType(DefaultUserQuotaValue); - /// Default group quota. - public static NetAppVolumeQuotaType DefaultGroupQuota { get; } = new NetAppVolumeQuotaType(DefaultGroupQuotaValue); - /// Individual user quota. - public static NetAppVolumeQuotaType IndividualUserQuota { get; } = new NetAppVolumeQuotaType(IndividualUserQuotaValue); - /// Individual group quota. - public static NetAppVolumeQuotaType IndividualGroupQuota { get; } = new NetAppVolumeQuotaType(IndividualGroupQuotaValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppVolumeQuotaType left, NetAppVolumeQuotaType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppVolumeQuotaType left, NetAppVolumeQuotaType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppVolumeQuotaType(string value) => new NetAppVolumeQuotaType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppVolumeQuotaType other && Equals(other); - /// - public bool Equals(NetAppVolumeQuotaType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReestablishReplicationContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReestablishReplicationContent.Serialization.cs deleted file mode 100644 index cd670963036f..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReestablishReplicationContent.Serialization.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeReestablishReplicationContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeReestablishReplicationContent)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SourceVolumeId)) - { - writer.WritePropertyName("sourceVolumeId"u8); - writer.WriteStringValue(SourceVolumeId); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeReestablishReplicationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeReestablishReplicationContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeReestablishReplicationContent(document.RootElement, options); - } - - internal static NetAppVolumeReestablishReplicationContent DeserializeNetAppVolumeReestablishReplicationContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier sourceVolumeId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sourceVolumeId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sourceVolumeId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeReestablishReplicationContent(sourceVolumeId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeReestablishReplicationContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeReestablishReplicationContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeReestablishReplicationContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeReestablishReplicationContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReestablishReplicationContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReestablishReplicationContent.cs deleted file mode 100644 index e9e430126e23..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReestablishReplicationContent.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Re-establish request object supplied in the body of the operation. - public partial class NetAppVolumeReestablishReplicationContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumeReestablishReplicationContent() - { - } - - /// Initializes a new instance of . - /// Resource id of the source volume for the replication. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeReestablishReplicationContent(ResourceIdentifier sourceVolumeId, IDictionary serializedAdditionalRawData) - { - SourceVolumeId = sourceVolumeId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Resource id of the source volume for the replication. - public ResourceIdentifier SourceVolumeId { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRelocationProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRelocationProperties.Serialization.cs deleted file mode 100644 index 1f3a3721bb02..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRelocationProperties.Serialization.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeRelocationProperties : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeRelocationProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsRelocationRequested)) - { - writer.WritePropertyName("relocationRequested"u8); - writer.WriteBooleanValue(IsRelocationRequested.Value); - } - if (options.Format != "W" && Optional.IsDefined(IsReadyToBeFinalized)) - { - writer.WritePropertyName("readyToBeFinalized"u8); - writer.WriteBooleanValue(IsReadyToBeFinalized.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeRelocationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeRelocationProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeRelocationProperties(document.RootElement, options); - } - - internal static NetAppVolumeRelocationProperties DeserializeNetAppVolumeRelocationProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? relocationRequested = default; - bool? readyToBeFinalized = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("relocationRequested"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - relocationRequested = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("readyToBeFinalized"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - readyToBeFinalized = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeRelocationProperties(relocationRequested, readyToBeFinalized, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeRelocationProperties)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeRelocationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeRelocationProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeRelocationProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRelocationProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRelocationProperties.cs deleted file mode 100644 index cba21b3116e6..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRelocationProperties.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Volume relocation properties. - public partial class NetAppVolumeRelocationProperties - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumeRelocationProperties() - { - } - - /// Initializes a new instance of . - /// Has relocation been requested for this volume. - /// Has relocation finished and is ready to be cleaned up. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeRelocationProperties(bool? isRelocationRequested, bool? isReadyToBeFinalized, IDictionary serializedAdditionalRawData) - { - IsRelocationRequested = isRelocationRequested; - IsReadyToBeFinalized = isReadyToBeFinalized; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Has relocation been requested for this volume. - public bool? IsRelocationRequested { get; set; } - /// Has relocation finished and is ready to be cleaned up. - public bool? IsReadyToBeFinalized { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplication.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplication.Serialization.cs deleted file mode 100644 index f99eff95b895..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplication.Serialization.cs +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeReplication : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeReplication)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsDefined(ReplicationId)) - { - writer.WritePropertyName("replicationId"u8); - writer.WriteStringValue(ReplicationId); - } - if (Optional.IsDefined(EndpointType)) - { - writer.WritePropertyName("endpointType"u8); - writer.WriteStringValue(EndpointType.Value.ToString()); - } - if (Optional.IsDefined(ReplicationSchedule)) - { - writer.WritePropertyName("replicationSchedule"u8); - writer.WriteStringValue(ReplicationSchedule.Value.ToString()); - } - writer.WritePropertyName("remoteVolumeResourceId"u8); - writer.WriteStringValue(RemoteVolumeResourceId); - if (Optional.IsDefined(RemoteVolumeRegion)) - { - writer.WritePropertyName("remoteVolumeRegion"u8); - writer.WriteStringValue(RemoteVolumeRegion); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeReplication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeReplication)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeReplication(document.RootElement, options); - } - - internal static NetAppVolumeReplication DeserializeNetAppVolumeReplication(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string replicationId = default; - NetAppEndpointType? endpointType = default; - NetAppReplicationSchedule? replicationSchedule = default; - ResourceIdentifier remoteVolumeResourceId = default; - string remoteVolumeRegion = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("replicationId"u8)) - { - replicationId = property.Value.GetString(); - continue; - } - if (property.NameEquals("endpointType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - endpointType = new NetAppEndpointType(property.Value.GetString()); - continue; - } - if (property.NameEquals("replicationSchedule"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - replicationSchedule = new NetAppReplicationSchedule(property.Value.GetString()); - continue; - } - if (property.NameEquals("remoteVolumeResourceId"u8)) - { - remoteVolumeResourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("remoteVolumeRegion"u8)) - { - remoteVolumeRegion = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeReplication( - replicationId, - endpointType, - replicationSchedule, - remoteVolumeResourceId, - remoteVolumeRegion, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeReplication)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeReplication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeReplication(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeReplication)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplication.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplication.cs deleted file mode 100644 index bd5b49140822..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplication.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Replication properties. - public partial class NetAppVolumeReplication - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The resource ID of the remote volume. - /// is null. - internal NetAppVolumeReplication(ResourceIdentifier remoteVolumeResourceId) - { - Argument.AssertNotNull(remoteVolumeResourceId, nameof(remoteVolumeResourceId)); - - RemoteVolumeResourceId = remoteVolumeResourceId; - } - - /// Initializes a new instance of . - /// UUID v4 used to identify the replication. - /// Indicates whether the local volume is the source or destination for the Volume Replication. - /// Schedule. - /// The resource ID of the remote volume. - /// The remote region for the other end of the Volume Replication. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeReplication(string replicationId, NetAppEndpointType? endpointType, NetAppReplicationSchedule? replicationSchedule, ResourceIdentifier remoteVolumeResourceId, string remoteVolumeRegion, IDictionary serializedAdditionalRawData) - { - ReplicationId = replicationId; - EndpointType = endpointType; - ReplicationSchedule = replicationSchedule; - RemoteVolumeResourceId = remoteVolumeResourceId; - RemoteVolumeRegion = remoteVolumeRegion; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppVolumeReplication() - { - } - - /// UUID v4 used to identify the replication. - public string ReplicationId { get; } - /// Indicates whether the local volume is the source or destination for the Volume Replication. - public NetAppEndpointType? EndpointType { get; } - /// Schedule. - public NetAppReplicationSchedule? ReplicationSchedule { get; } - /// The resource ID of the remote volume. - public ResourceIdentifier RemoteVolumeResourceId { get; } - /// The remote region for the other end of the Volume Replication. - public string RemoteVolumeRegion { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplicationStatus.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplicationStatus.Serialization.cs deleted file mode 100644 index 605c975cca31..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplicationStatus.Serialization.cs +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeReplicationStatus : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeReplicationStatus)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsHealthy)) - { - writer.WritePropertyName("healthy"u8); - writer.WriteBooleanValue(IsHealthy.Value); - } - if (Optional.IsDefined(VolumeReplicationRelationshipStatus)) - { - writer.WritePropertyName("relationshipStatus"u8); - writer.WriteStringValue(VolumeReplicationRelationshipStatus.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(MirrorState)) - { - writer.WritePropertyName("mirrorState"u8); - writer.WriteStringValue(MirrorState.Value.ToString()); - } - if (Optional.IsDefined(TotalProgress)) - { - writer.WritePropertyName("totalProgress"u8); - writer.WriteStringValue(TotalProgress); - } - if (Optional.IsDefined(ErrorMessage)) - { - writer.WritePropertyName("errorMessage"u8); - writer.WriteStringValue(ErrorMessage); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeReplicationStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeReplicationStatus)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeReplicationStatus(document.RootElement, options); - } - - internal static NetAppVolumeReplicationStatus DeserializeNetAppVolumeReplicationStatus(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? healthy = default; - VolumeReplicationRelationshipStatus? relationshipStatus = default; - NetAppMirrorState? mirrorState = default; - string totalProgress = default; - string errorMessage = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("healthy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - healthy = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("relationshipStatus"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - relationshipStatus = new VolumeReplicationRelationshipStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("mirrorState"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mirrorState = new NetAppMirrorState(property.Value.GetString()); - continue; - } - if (property.NameEquals("totalProgress"u8)) - { - totalProgress = property.Value.GetString(); - continue; - } - if (property.NameEquals("errorMessage"u8)) - { - errorMessage = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeReplicationStatus( - healthy, - relationshipStatus, - mirrorState, - totalProgress, - errorMessage, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeReplicationStatus)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeReplicationStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeReplicationStatus(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeReplicationStatus)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplicationStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplicationStatus.cs deleted file mode 100644 index da74c715b05e..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeReplicationStatus.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Replication status. - public partial class NetAppVolumeReplicationStatus - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal NetAppVolumeReplicationStatus() - { - } - - /// Initializes a new instance of . - /// Replication health check. - /// Status of the mirror relationship. - /// The mirror state property describes the current status of data replication for a replication. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. - /// The progress of the replication. - /// Displays error message if the replication is in an error state. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeReplicationStatus(bool? isHealthy, VolumeReplicationRelationshipStatus? volumeReplicationRelationshipStatus, NetAppMirrorState? mirrorState, string totalProgress, string errorMessage, IDictionary serializedAdditionalRawData) - { - IsHealthy = isHealthy; - VolumeReplicationRelationshipStatus = volumeReplicationRelationshipStatus; - MirrorState = mirrorState; - TotalProgress = totalProgress; - ErrorMessage = errorMessage; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Replication health check. - public bool? IsHealthy { get; } - /// Status of the mirror relationship. - public VolumeReplicationRelationshipStatus? VolumeReplicationRelationshipStatus { get; } - /// The mirror state property describes the current status of data replication for a replication. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. - public NetAppMirrorState? MirrorState { get; } - /// The progress of the replication. - public string TotalProgress { get; } - /// Displays error message if the replication is in an error state. - public string ErrorMessage { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRevertContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRevertContent.Serialization.cs deleted file mode 100644 index 2f353d4d8a27..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRevertContent.Serialization.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeRevertContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeRevertContent)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SnapshotId)) - { - writer.WritePropertyName("snapshotId"u8); - writer.WriteStringValue(SnapshotId); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeRevertContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeRevertContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeRevertContent(document.RootElement, options); - } - - internal static NetAppVolumeRevertContent DeserializeNetAppVolumeRevertContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string snapshotId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("snapshotId"u8)) - { - snapshotId = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeRevertContent(snapshotId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeRevertContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeRevertContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeRevertContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeRevertContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRevertContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRevertContent.cs deleted file mode 100644 index 630f5acb4ed5..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeRevertContent.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// revert a volume to the snapshot. - public partial class NetAppVolumeRevertContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumeRevertContent() - { - } - - /// Initializes a new instance of . - /// Resource id of the snapshot. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeRevertContent(string snapshotId, IDictionary serializedAdditionalRawData) - { - SnapshotId = snapshotId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Resource id of the snapshot. - public string SnapshotId { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSecurityStyle.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSecurityStyle.cs deleted file mode 100644 index fd27af64ccfb..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSecurityStyle.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - public readonly partial struct NetAppVolumeSecurityStyle : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppVolumeSecurityStyle(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NtfsValue = "ntfs"; - private const string UnixValue = "unix"; - - /// ntfs. - public static NetAppVolumeSecurityStyle Ntfs { get; } = new NetAppVolumeSecurityStyle(NtfsValue); - /// unix. - public static NetAppVolumeSecurityStyle Unix { get; } = new NetAppVolumeSecurityStyle(UnixValue); - /// Determines if two values are the same. - public static bool operator ==(NetAppVolumeSecurityStyle left, NetAppVolumeSecurityStyle right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppVolumeSecurityStyle left, NetAppVolumeSecurityStyle right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppVolumeSecurityStyle(string value) => new NetAppVolumeSecurityStyle(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppVolumeSecurityStyle other && Equals(other); - /// - public bool Equals(NetAppVolumeSecurityStyle other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSnapshotRestoreFilesContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSnapshotRestoreFilesContent.Serialization.cs deleted file mode 100644 index 8e4b6ec63f52..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSnapshotRestoreFilesContent.Serialization.cs +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class NetAppVolumeSnapshotRestoreFilesContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeSnapshotRestoreFilesContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("filePaths"u8); - writer.WriteStartArray(); - foreach (var item in FilePaths) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(DestinationPath)) - { - writer.WritePropertyName("destinationPath"u8); - writer.WriteStringValue(DestinationPath); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - NetAppVolumeSnapshotRestoreFilesContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeSnapshotRestoreFilesContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeSnapshotRestoreFilesContent(document.RootElement, options); - } - - internal static NetAppVolumeSnapshotRestoreFilesContent DeserializeNetAppVolumeSnapshotRestoreFilesContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList filePaths = default; - string destinationPath = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("filePaths"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - filePaths = array; - continue; - } - if (property.NameEquals("destinationPath"u8)) - { - destinationPath = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeSnapshotRestoreFilesContent(filePaths, destinationPath, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeSnapshotRestoreFilesContent)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeSnapshotRestoreFilesContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeSnapshotRestoreFilesContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeSnapshotRestoreFilesContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSnapshotRestoreFilesContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSnapshotRestoreFilesContent.cs deleted file mode 100644 index 4156ce0a5876..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeSnapshotRestoreFilesContent.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Restore payload for Single File Snapshot Restore. - public partial class NetAppVolumeSnapshotRestoreFilesContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// List of files to be restored. - /// is null. - public NetAppVolumeSnapshotRestoreFilesContent(IEnumerable filePaths) - { - Argument.AssertNotNull(filePaths, nameof(filePaths)); - - FilePaths = filePaths.ToList(); - } - - /// Initializes a new instance of . - /// List of files to be restored. - /// Destination folder where the files will be restored. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeSnapshotRestoreFilesContent(IList filePaths, string destinationPath, IDictionary serializedAdditionalRawData) - { - FilePaths = filePaths; - DestinationPath = destinationPath; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppVolumeSnapshotRestoreFilesContent() - { - } - - /// List of files to be restored. - public IList FilePaths { get; } - /// Destination folder where the files will be restored. - public string DestinationPath { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeStorageToNetworkProximity.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeStorageToNetworkProximity.cs deleted file mode 100644 index d57a82da5315..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeStorageToNetworkProximity.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Provides storage to network proximity information for the volume. - public readonly partial struct NetAppVolumeStorageToNetworkProximity : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetAppVolumeStorageToNetworkProximity(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DefaultValue = "Default"; - private const string T1Value = "T1"; - private const string T2Value = "T2"; - private const string AcrossT2Value = "AcrossT2"; - - /// Basic storage to network connectivity. - public static NetAppVolumeStorageToNetworkProximity Default { get; } = new NetAppVolumeStorageToNetworkProximity(DefaultValue); - /// Standard T1 storage to network connectivity. - public static NetAppVolumeStorageToNetworkProximity T1 { get; } = new NetAppVolumeStorageToNetworkProximity(T1Value); - /// Standard T2 storage to network connectivity. - public static NetAppVolumeStorageToNetworkProximity T2 { get; } = new NetAppVolumeStorageToNetworkProximity(T2Value); - /// Standard AcrossT2 storage to network connectivity. - public static NetAppVolumeStorageToNetworkProximity AcrossT2 { get; } = new NetAppVolumeStorageToNetworkProximity(AcrossT2Value); - /// Determines if two values are the same. - public static bool operator ==(NetAppVolumeStorageToNetworkProximity left, NetAppVolumeStorageToNetworkProximity right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetAppVolumeStorageToNetworkProximity left, NetAppVolumeStorageToNetworkProximity right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetAppVolumeStorageToNetworkProximity(string value) => new NetAppVolumeStorageToNetworkProximity(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetAppVolumeStorageToNetworkProximity other && Equals(other); - /// - public bool Equals(NetAppVolumeStorageToNetworkProximity other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkFeatures.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkFeatures.cs new file mode 100644 index 000000000000..defd93bd70e3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkFeatures.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Network features available to the volume, or current state of update. + public readonly partial struct NetworkFeatures : IEquatable + { + private readonly string _value; + /// Basic network features. + private const string BasicValue = "Basic"; + /// Standard network features. + private const string StandardValue = "Standard"; + /// Updating from Basic to Standard network features. + private const string BasicStandardValue = "Basic_Standard"; + /// Updating from Standard to Basic network features. + private const string StandardBasicValue = "Standard_Basic"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public NetworkFeatures(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Basic network features. + public static NetworkFeatures Basic { get; } = new NetworkFeatures(BasicValue); + + /// Standard network features. + public static NetworkFeatures Standard { get; } = new NetworkFeatures(StandardValue); + + /// Updating from Basic to Standard network features. + public static NetworkFeatures BasicStandard { get; } = new NetworkFeatures(BasicStandardValue); + + /// Updating from Standard to Basic network features. + public static NetworkFeatures StandardBasic { get; } = new NetworkFeatures(StandardBasicValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(NetworkFeatures left, NetworkFeatures right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(NetworkFeatures left, NetworkFeatures right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator NetworkFeatures(string value) => new NetworkFeatures(value); + + /// Converts a string to a . + /// The value. + public static implicit operator NetworkFeatures?(string value) => value == null ? null : new NetworkFeatures(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NetworkFeatures other && Equals(other); + + /// + public bool Equals(NetworkFeatures other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSet.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSet.Serialization.cs index 7a1e180b626f..d5087a255956 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSet.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSet.Serialization.cs @@ -9,14 +9,17 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class NetworkSiblingSet : IUtf8JsonSerializable, IJsonModel + /// Describes the contents of a network sibling set. + public partial class NetworkSiblingSet : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +31,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetworkSiblingSet)} does not support writing '{format}' format."); } - if (Optional.IsDefined(NetworkSiblingSetId)) { writer.WritePropertyName("networkSiblingSetId"u8); @@ -63,21 +65,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("nicInfoList"u8); writer.WriteStartArray(); - foreach (var item in NicInfoList) + foreach (NicInfo item in NicInfoList) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -86,22 +88,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NetworkSiblingSet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + NetworkSiblingSet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NetworkSiblingSet JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetworkSiblingSet)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeNetworkSiblingSet(document.RootElement, options); } - internal static NetworkSiblingSet DeserializeNetworkSiblingSet(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NetworkSiblingSet DeserializeNetworkSiblingSet(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -109,58 +116,57 @@ internal static NetworkSiblingSet DeserializeNetworkSiblingSet(JsonElement eleme string networkSiblingSetId = default; ResourceIdentifier subnetId = default; string networkSiblingSetStateId = default; - NetAppNetworkFeature? networkFeatures = default; + NetworkFeatures? networkFeatures = default; NetworkSiblingSetProvisioningState? provisioningState = default; IReadOnlyList nicInfoList = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("networkSiblingSetId"u8)) + if (prop.NameEquals("networkSiblingSetId"u8)) { - networkSiblingSetId = property.Value.GetString(); + networkSiblingSetId = prop.Value.GetString(); continue; } - if (property.NameEquals("subnetId"u8)) + if (prop.NameEquals("subnetId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - subnetId = new ResourceIdentifier(property.Value.GetString()); + subnetId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("networkSiblingSetStateId"u8)) + if (prop.NameEquals("networkSiblingSetStateId"u8)) { - networkSiblingSetStateId = property.Value.GetString(); + networkSiblingSetStateId = prop.Value.GetString(); continue; } - if (property.NameEquals("networkFeatures"u8)) + if (prop.NameEquals("networkFeatures"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - networkFeatures = new NetAppNetworkFeature(property.Value.GetString()); + networkFeatures = new NetworkFeatures(prop.Value.GetString()); continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new NetworkSiblingSetProvisioningState(property.Value.GetString()); + provisioningState = new NetworkSiblingSetProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("nicInfoList"u8)) + if (prop.NameEquals("nicInfoList"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(NicInfo.DeserializeNicInfo(item, options)); } @@ -169,10 +175,9 @@ internal static NetworkSiblingSet DeserializeNetworkSiblingSet(JsonElement eleme } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new NetworkSiblingSet( networkSiblingSetId, subnetId, @@ -180,13 +185,16 @@ internal static NetworkSiblingSet DeserializeNetworkSiblingSet(JsonElement eleme networkFeatures, provisioningState, nicInfoList ?? new ChangeTrackingList(), - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -196,15 +204,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - NetworkSiblingSet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + NetworkSiblingSet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NetworkSiblingSet PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeNetworkSiblingSet(document.RootElement, options); } default: @@ -212,6 +225,15 @@ NetworkSiblingSet IPersistableModel.Create(BinaryData data, M } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static NetworkSiblingSet FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeNetworkSiblingSet(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSet.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSet.cs index 6a9c3ba41cc4..18736e723a1d 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSet.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSet.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Describes the contents of a network sibling set. public partial class NetworkSiblingSet { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal NetworkSiblingSet() @@ -59,8 +31,8 @@ internal NetworkSiblingSet() /// Network features available to the volume, or current state of update. /// Gets the status of the NetworkSiblingSet at the time the operation was called. /// List of NIC information. - /// Keeps track of any properties unknown to the library. - internal NetworkSiblingSet(string networkSiblingSetId, ResourceIdentifier subnetId, string networkSiblingSetStateId, NetAppNetworkFeature? networkFeatures, NetworkSiblingSetProvisioningState? provisioningState, IReadOnlyList nicInfoList, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal NetworkSiblingSet(string networkSiblingSetId, ResourceIdentifier subnetId, string networkSiblingSetStateId, NetworkFeatures? networkFeatures, NetworkSiblingSetProvisioningState? provisioningState, IReadOnlyList nicInfoList, IDictionary additionalBinaryDataProperties) { NetworkSiblingSetId = networkSiblingSetId; SubnetId = subnetId; @@ -68,19 +40,24 @@ internal NetworkSiblingSet(string networkSiblingSetId, ResourceIdentifier subnet NetworkFeatures = networkFeatures; ProvisioningState = provisioningState; NicInfoList = nicInfoList; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. public string NetworkSiblingSetId { get; } + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. public ResourceIdentifier SubnetId { get; } + /// Network sibling set state Id identifying the current state of the sibling set. public string NetworkSiblingSetStateId { get; } + /// Network features available to the volume, or current state of update. - public NetAppNetworkFeature? NetworkFeatures { get; } + public NetworkFeatures? NetworkFeatures { get; } + /// Gets the status of the NetworkSiblingSet at the time the operation was called. public NetworkSiblingSetProvisioningState? ProvisioningState { get; } + /// List of NIC information. public IReadOnlyList NicInfoList { get; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSetProvisioningState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSetProvisioningState.cs index 0bdbfc607f39..7c247e69fe15 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSetProvisioningState.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetworkSiblingSetProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,44 +15,63 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct NetworkSiblingSetProvisioningState : IEquatable { private readonly string _value; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string UpdatingValue = "Updating"; /// Initializes a new instance of . + /// The value. /// is null. public NetworkSiblingSetProvisioningState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CanceledValue = "Canceled"; - private const string UpdatingValue = "Updating"; + _value = value; + } - /// Succeeded. + /// Gets the Succeeded. public static NetworkSiblingSetProvisioningState Succeeded { get; } = new NetworkSiblingSetProvisioningState(SucceededValue); - /// Failed. + + /// Gets the Failed. public static NetworkSiblingSetProvisioningState Failed { get; } = new NetworkSiblingSetProvisioningState(FailedValue); - /// Canceled. + + /// Gets the Canceled. public static NetworkSiblingSetProvisioningState Canceled { get; } = new NetworkSiblingSetProvisioningState(CanceledValue); - /// Updating. + + /// Gets the Updating. public static NetworkSiblingSetProvisioningState Updating { get; } = new NetworkSiblingSetProvisioningState(UpdatingValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(NetworkSiblingSetProvisioningState left, NetworkSiblingSetProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(NetworkSiblingSetProvisioningState left, NetworkSiblingSetProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator NetworkSiblingSetProvisioningState(string value) => new NetworkSiblingSetProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator NetworkSiblingSetProvisioningState?(string value) => value == null ? null : new NetworkSiblingSetProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is NetworkSiblingSetProvisioningState other && Equals(other); - /// + + /// public bool Equals(NetworkSiblingSetProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NfsUser.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NfsUser.Serialization.cs new file mode 100644 index 000000000000..e33e8f909289 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NfsUser.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The effective NFS User ID and Group ID when accessing the volume data. + public partial class NfsUser : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NfsUser)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(UserId)) + { + writer.WritePropertyName("userId"u8); + writer.WriteNumberValue(UserId.Value); + } + if (Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteNumberValue(GroupId.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + NfsUser IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NfsUser JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NfsUser)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNfsUser(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NfsUser DeserializeNfsUser(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? userId = default; + long? groupId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("userId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userId = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("groupId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupId = prop.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new NfsUser(userId, groupId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(NfsUser)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + NfsUser IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NfsUser PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeNfsUser(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NfsUser)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NfsUser.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NfsUser.cs new file mode 100644 index 000000000000..dd4bf290f97a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NfsUser.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The effective NFS User ID and Group ID when accessing the volume data. + public partial class NfsUser + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public NfsUser() + { + } + + /// Initializes a new instance of . + /// The NFS user's UID. + /// The NFS user's GID. + /// Keeps track of any properties unknown to the library. + internal NfsUser(long? userId, long? groupId, IDictionary additionalBinaryDataProperties) + { + UserId = userId; + GroupId = groupId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The NFS user's UID. + public long? UserId { get; set; } + + /// The NFS user's GID. + public long? GroupId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NicInfo.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NicInfo.Serialization.cs index 9e1b4d604c19..40cd09d0ac08 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NicInfo.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NicInfo.Serialization.cs @@ -10,13 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class NicInfo : IUtf8JsonSerializable, IJsonModel + /// NIC information and list of volumes for which the NIC has the primary mount ip address. + public partial class NicInfo : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,22 +30,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions o /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NicInfo)} does not support writing '{format}' format."); } - - if (options.Format != "W" && Optional.IsDefined(IPAddress)) + if (options.Format != "W" && Optional.IsDefined(IpAddress)) { writer.WritePropertyName("ipAddress"u8); - writer.WriteStringValue(IPAddress); + writer.WriteStringValue(IpAddress); } if (Optional.IsCollectionDefined(VolumeResourceIds)) { writer.WritePropertyName("volumeResourceIds"u8); writer.WriteStartArray(); - foreach (var item in VolumeResourceIds) + foreach (ResourceIdentifier item in VolumeResourceIds) { if (item == null) { @@ -54,15 +55,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -71,45 +72,49 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NicInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + NicInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NicInfo JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NicInfo)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeNicInfo(document.RootElement, options); } - internal static NicInfo DeserializeNicInfo(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NicInfo DeserializeNicInfo(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string ipAddress = default; IReadOnlyList volumeResourceIds = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("ipAddress"u8)) + if (prop.NameEquals("ipAddress"u8)) { - ipAddress = property.Value.GetString(); + ipAddress = prop.Value.GetString(); continue; } - if (property.NameEquals("volumeResourceIds"u8)) + if (prop.NameEquals("volumeResourceIds"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { @@ -125,17 +130,19 @@ internal static NicInfo DeserializeNicInfo(JsonElement element, ModelReaderWrite } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new NicInfo(ipAddress, volumeResourceIds ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new NicInfo(ipAddress, volumeResourceIds ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -145,15 +152,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - NicInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + NicInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NicInfo PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeNicInfo(document.RootElement, options); } default: @@ -161,6 +173,7 @@ NicInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOpti } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NicInfo.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NicInfo.cs index f134a4c5b41c..5ff5ee09495d 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NicInfo.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NicInfo.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// NIC information and list of volumes for which the NIC has the primary mount ip address. public partial class NicInfo { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal NicInfo() @@ -55,16 +27,17 @@ internal NicInfo() /// Initializes a new instance of . /// ipAddress. /// Volume resource Ids. - /// Keeps track of any properties unknown to the library. - internal NicInfo(string ipAddress, IReadOnlyList volumeResourceIds, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal NicInfo(string ipAddress, IReadOnlyList volumeResourceIds, IDictionary additionalBinaryDataProperties) { - IPAddress = ipAddress; + IpAddress = ipAddress; VolumeResourceIds = volumeResourceIds; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// ipAddress. - public string IPAddress { get; } + public string IpAddress { get; } + /// Volume resource Ids. public IReadOnlyList VolumeResourceIds { get; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Operation.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Operation.Serialization.cs new file mode 100644 index 000000000000..87bee7fbea83 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Operation.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Microsoft.NetApp REST API operation definition. + public partial class Operation : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Operation)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Display)) + { + writer.WritePropertyName("display"u8); + writer.WriteObjectValue(Display, options); + } + if (Optional.IsDefined(Origin)) + { + writer.WritePropertyName("origin"u8); + writer.WriteStringValue(Origin); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + Operation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual Operation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Operation)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperation(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static Operation DeserializeOperation(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + OperationDisplay display = default; + string origin = default; + OperationProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("display"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + display = OperationDisplay.DeserializeOperationDisplay(prop.Value, options); + continue; + } + if (prop.NameEquals("origin"u8)) + { + origin = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = OperationProperties.DeserializeOperationProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new Operation(name, display, origin, properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(Operation)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + Operation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual Operation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeOperation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Operation)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Operation.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..f3486cdeb0ca --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Operation.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Microsoft.NetApp REST API operation definition. + public partial class Operation + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal Operation() + { + } + + /// Initializes a new instance of . + /// Operation name: {provider}/{resource}/{operation}. + /// Display metadata associated with the operation. + /// The origin of operations. + /// Properties of operation, include metric specifications. + /// Keeps track of any properties unknown to the library. + internal Operation(string name, OperationDisplay display, string origin, OperationProperties properties, IDictionary additionalBinaryDataProperties) + { + Name = name; + Display = display; + Origin = origin; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Operation name: {provider}/{resource}/{operation}. + public string Name { get; } + + /// Display metadata associated with the operation. + public OperationDisplay Display { get; } + + /// The origin of operations. + public string Origin { get; } + + /// Properties of operation, include metric specifications. + internal OperationProperties Properties { get; } + + /// One property of operation, include metric specifications. + public ServiceSpecification ServiceSpecification + { + get + { + return Properties.ServiceSpecification; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationDisplay.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationDisplay.Serialization.cs new file mode 100644 index 000000000000..7edf06854722 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationDisplay.Serialization.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Display metadata associated with the operation. + public partial class OperationDisplay : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationDisplay)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Provider)) + { + writer.WritePropertyName("provider"u8); + writer.WriteStringValue(Provider); + } + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + writer.WriteStringValue(Resource); + } + if (Optional.IsDefined(Operation)) + { + writer.WritePropertyName("operation"u8); + writer.WriteStringValue(Operation); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + OperationDisplay IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual OperationDisplay JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationDisplay)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationDisplay(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static OperationDisplay DeserializeOperationDisplay(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string provider = default; + string resource = default; + string operation = default; + string description = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provider"u8)) + { + provider = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("resource"u8)) + { + resource = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("operation"u8)) + { + operation = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("description"u8)) + { + description = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new OperationDisplay(provider, resource, operation, description, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(OperationDisplay)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + OperationDisplay IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual OperationDisplay PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeOperationDisplay(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationDisplay)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationDisplay.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..b1c37deae6bb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Display metadata associated with the operation. + public partial class OperationDisplay + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal OperationDisplay() + { + } + + /// Initializes a new instance of . + /// Service provider: Microsoft NetApp. + /// Resource on which the operation is performed etc. + /// Type of operation: get, read, delete, etc. + /// Operation description. + /// Keeps track of any properties unknown to the library. + internal OperationDisplay(string provider, string resource, string operation, string description, IDictionary additionalBinaryDataProperties) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Service provider: Microsoft NetApp. + public string Provider { get; } + + /// Resource on which the operation is performed etc. + public string Resource { get; } + + /// Type of operation: get, read, delete, etc. + public string Operation { get; } + + /// Operation description. + public string Description { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationListResult.Serialization.cs new file mode 100644 index 000000000000..b754992e56dd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationListResult.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + internal partial class OperationListResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal OperationListResult() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationListResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (Operation item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + OperationListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual OperationListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationListResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationListResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static OperationListResult DeserializeOperationListResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(Operation.DeserializeOperation(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new OperationListResult(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(OperationListResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + OperationListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual OperationListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeOperationListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationListResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static OperationListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeOperationListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationListResult.cs new file mode 100644 index 000000000000..d691f9ed17bd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationListResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + internal partial class OperationListResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The Operation items on this page. + internal OperationListResult(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Operation items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal OperationListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The Operation items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationProperties.Serialization.cs new file mode 100644 index 000000000000..ab76d6fdb510 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationProperties.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of operation, include metric specifications. + internal partial class OperationProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(ServiceSpecification)) + { + writer.WritePropertyName("serviceSpecification"u8); + writer.WriteObjectValue(ServiceSpecification, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + OperationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual OperationProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static OperationProperties DeserializeOperationProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ServiceSpecification serviceSpecification = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("serviceSpecification"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceSpecification = ServiceSpecification.DeserializeServiceSpecification(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new OperationProperties(serviceSpecification, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(OperationProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + OperationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual OperationProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeOperationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationProperties.cs new file mode 100644 index 000000000000..50e8d51564d6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OperationProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of operation, include metric specifications. + internal partial class OperationProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal OperationProperties() + { + } + + /// Initializes a new instance of . + /// One property of operation, include metric specifications. + /// Keeps track of any properties unknown to the library. + internal OperationProperties(ServiceSpecification serviceSpecification, IDictionary additionalBinaryDataProperties) + { + ServiceSpecification = serviceSpecification; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// One property of operation, include metric specifications. + public ServiceSpecification ServiceSpecification { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OriginClusterInformation.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OriginClusterInformation.Serialization.cs new file mode 100644 index 000000000000..b2c0f9aba30e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OriginClusterInformation.Serialization.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Stores the origin cluster information associated to a cache. + public partial class OriginClusterInformation : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal OriginClusterInformation() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OriginClusterInformation)} does not support writing '{format}' format."); + } + writer.WritePropertyName("peerClusterName"u8); + writer.WriteStringValue(PeerClusterName); + writer.WritePropertyName("peerAddresses"u8); + writer.WriteStartArray(); + foreach (string item in PeerAddresses) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("peerVserverName"u8); + writer.WriteStringValue(PeerVserverName); + writer.WritePropertyName("peerVolumeName"u8); + writer.WriteStringValue(PeerVolumeName); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + OriginClusterInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual OriginClusterInformation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OriginClusterInformation)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOriginClusterInformation(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static OriginClusterInformation DeserializeOriginClusterInformation(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string peerClusterName = default; + IList peerAddresses = default; + string peerVserverName = default; + string peerVolumeName = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("peerClusterName"u8)) + { + peerClusterName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("peerAddresses"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + peerAddresses = array; + continue; + } + if (prop.NameEquals("peerVserverName"u8)) + { + peerVserverName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("peerVolumeName"u8)) + { + peerVolumeName = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new OriginClusterInformation(peerClusterName, peerAddresses, peerVserverName, peerVolumeName, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(OriginClusterInformation)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + OriginClusterInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual OriginClusterInformation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeOriginClusterInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OriginClusterInformation)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OriginClusterInformation.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OriginClusterInformation.cs new file mode 100644 index 000000000000..a3950d0b1e2b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/OriginClusterInformation.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Stores the origin cluster information associated to a cache. + public partial class OriginClusterInformation + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// ONTAP cluster name of external cluster hosting the origin volume. + /// ONTAP Intercluster LIF IP addresses. One IP address per cluster node is required. + /// External Vserver (SVM) name name of the SVM hosting the origin volume. + /// External origin volume name associated to this cache. + /// , , or is null. + public OriginClusterInformation(string peerClusterName, IEnumerable peerAddresses, string peerVserverName, string peerVolumeName) + { + Argument.AssertNotNull(peerClusterName, nameof(peerClusterName)); + Argument.AssertNotNull(peerAddresses, nameof(peerAddresses)); + Argument.AssertNotNull(peerVserverName, nameof(peerVserverName)); + Argument.AssertNotNull(peerVolumeName, nameof(peerVolumeName)); + + PeerClusterName = peerClusterName; + PeerAddresses = peerAddresses.ToList(); + PeerVserverName = peerVserverName; + PeerVolumeName = peerVolumeName; + } + + /// Initializes a new instance of . + /// ONTAP cluster name of external cluster hosting the origin volume. + /// ONTAP Intercluster LIF IP addresses. One IP address per cluster node is required. + /// External Vserver (SVM) name name of the SVM hosting the origin volume. + /// External origin volume name associated to this cache. + /// Keeps track of any properties unknown to the library. + internal OriginClusterInformation(string peerClusterName, IList peerAddresses, string peerVserverName, string peerVolumeName, IDictionary additionalBinaryDataProperties) + { + PeerClusterName = peerClusterName; + PeerAddresses = peerAddresses; + PeerVserverName = peerVserverName; + PeerVolumeName = peerVolumeName; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// ONTAP cluster name of external cluster hosting the origin volume. + public string PeerClusterName { get; set; } + + /// ONTAP Intercluster LIF IP addresses. One IP address per cluster node is required. + public IList PeerAddresses { get; } + + /// External Vserver (SVM) name name of the SVM hosting the origin volume. + public string PeerVserverName { get; set; } + + /// External origin volume name associated to this cache. + public string PeerVolumeName { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationContent.Serialization.cs deleted file mode 100644 index 48268faf5999..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationContent.Serialization.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class PeerClusterForVolumeMigrationContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PeerClusterForVolumeMigrationContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("peerIpAddresses"u8); - writer.WriteStartArray(); - foreach (var item in PeerIPAddresses) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - PeerClusterForVolumeMigrationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(PeerClusterForVolumeMigrationContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePeerClusterForVolumeMigrationContent(document.RootElement, options); - } - - internal static PeerClusterForVolumeMigrationContent DeserializePeerClusterForVolumeMigrationContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList peerIPAddresses = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("peerIpAddresses"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - peerIPAddresses = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PeerClusterForVolumeMigrationContent(peerIPAddresses, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(PeerClusterForVolumeMigrationContent)} does not support writing '{options.Format}' format."); - } - } - - PeerClusterForVolumeMigrationContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializePeerClusterForVolumeMigrationContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PeerClusterForVolumeMigrationContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationContent.cs deleted file mode 100644 index 80e371f55a85..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationContent.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Source Cluster properties for a cluster peer request. - public partial class PeerClusterForVolumeMigrationContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// A list of IC-LIF IPs that can be used to connect to the On-prem cluster. - /// is null. - public PeerClusterForVolumeMigrationContent(IEnumerable peerIPAddresses) - { - Argument.AssertNotNull(peerIPAddresses, nameof(peerIPAddresses)); - - PeerIPAddresses = peerIPAddresses.ToList(); - } - - /// Initializes a new instance of . - /// A list of IC-LIF IPs that can be used to connect to the On-prem cluster. - /// Keeps track of any properties unknown to the library. - internal PeerClusterForVolumeMigrationContent(IList peerIPAddresses, IDictionary serializedAdditionalRawData) - { - PeerIPAddresses = peerIPAddresses; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PeerClusterForVolumeMigrationContent() - { - } - - /// A list of IC-LIF IPs that can be used to connect to the On-prem cluster. - public IList PeerIPAddresses { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationRequest.Serialization.cs new file mode 100644 index 000000000000..65f1b6a70553 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationRequest.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Source Cluster properties for a cluster peer request. + public partial class PeerClusterForVolumeMigrationRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal PeerClusterForVolumeMigrationRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PeerClusterForVolumeMigrationRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("peerIpAddresses"u8); + writer.WriteStartArray(); + foreach (string item in PeerIpAddresses) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PeerClusterForVolumeMigrationRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PeerClusterForVolumeMigrationRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PeerClusterForVolumeMigrationRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePeerClusterForVolumeMigrationRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PeerClusterForVolumeMigrationRequest DeserializePeerClusterForVolumeMigrationRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList peerIpAddresses = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("peerIpAddresses"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + peerIpAddresses = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PeerClusterForVolumeMigrationRequest(peerIpAddresses, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(PeerClusterForVolumeMigrationRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PeerClusterForVolumeMigrationRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PeerClusterForVolumeMigrationRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializePeerClusterForVolumeMigrationRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PeerClusterForVolumeMigrationRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(PeerClusterForVolumeMigrationRequest peerClusterForVolumeMigrationRequest) + { + if (peerClusterForVolumeMigrationRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(peerClusterForVolumeMigrationRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationRequest.cs new file mode 100644 index 000000000000..dff896dcdb45 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeerClusterForVolumeMigrationRequest.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Source Cluster properties for a cluster peer request. + public partial class PeerClusterForVolumeMigrationRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// A list of IC-LIF IPs that can be used to connect to the On-prem cluster. + /// is null. + public PeerClusterForVolumeMigrationRequest(IEnumerable peerIpAddresses) + { + Argument.AssertNotNull(peerIpAddresses, nameof(peerIpAddresses)); + + PeerIpAddresses = peerIpAddresses.ToList(); + } + + /// Initializes a new instance of . + /// A list of IC-LIF IPs that can be used to connect to the On-prem cluster. + /// Keeps track of any properties unknown to the library. + internal PeerClusterForVolumeMigrationRequest(IList peerIpAddresses, IDictionary additionalBinaryDataProperties) + { + PeerIpAddresses = peerIpAddresses; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// A list of IC-LIF IPs that can be used to connect to the On-prem cluster. + public IList PeerIpAddresses { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeeringPassphrases.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeeringPassphrases.Serialization.cs new file mode 100644 index 000000000000..b121c37d7c02 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeeringPassphrases.Serialization.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response containing peering passphrases and commands for cluster and vserver peering. + public partial class PeeringPassphrases : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal PeeringPassphrases() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PeeringPassphrases)} does not support writing '{format}' format."); + } + writer.WritePropertyName("clusterPeeringCommand"u8); + writer.WriteStringValue(ClusterPeeringCommand); + writer.WritePropertyName("clusterPeeringPassphrase"u8); + writer.WriteStringValue(ClusterPeeringPassphrase); + writer.WritePropertyName("vserverPeeringCommand"u8); + writer.WriteStringValue(VserverPeeringCommand); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PeeringPassphrases IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PeeringPassphrases JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PeeringPassphrases)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePeeringPassphrases(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PeeringPassphrases DeserializePeeringPassphrases(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clusterPeeringCommand = default; + string clusterPeeringPassphrase = default; + string vserverPeeringCommand = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("clusterPeeringCommand"u8)) + { + clusterPeeringCommand = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("clusterPeeringPassphrase"u8)) + { + clusterPeeringPassphrase = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("vserverPeeringCommand"u8)) + { + vserverPeeringCommand = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PeeringPassphrases(clusterPeeringCommand, clusterPeeringPassphrase, vserverPeeringCommand, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(PeeringPassphrases)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PeeringPassphrases IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PeeringPassphrases PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializePeeringPassphrases(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PeeringPassphrases)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static PeeringPassphrases FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializePeeringPassphrases(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeeringPassphrases.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeeringPassphrases.cs new file mode 100644 index 000000000000..f17e94481a47 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PeeringPassphrases.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The response containing peering passphrases and commands for cluster and vserver peering. + public partial class PeeringPassphrases + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The cluster peering command. + /// The cluster peering passphrase. + /// The vserver peering command. + internal PeeringPassphrases(string clusterPeeringCommand, string clusterPeeringPassphrase, string vserverPeeringCommand) + { + ClusterPeeringCommand = clusterPeeringCommand; + ClusterPeeringPassphrase = clusterPeeringPassphrase; + VserverPeeringCommand = vserverPeeringCommand; + } + + /// Initializes a new instance of . + /// The cluster peering command. + /// The cluster peering passphrase. + /// The vserver peering command. + /// Keeps track of any properties unknown to the library. + internal PeeringPassphrases(string clusterPeeringCommand, string clusterPeeringPassphrase, string vserverPeeringCommand, IDictionary additionalBinaryDataProperties) + { + ClusterPeeringCommand = clusterPeeringCommand; + ClusterPeeringPassphrase = clusterPeeringPassphrase; + VserverPeeringCommand = vserverPeeringCommand; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The cluster peering command. + public string ClusterPeeringCommand { get; } + + /// The cluster peering passphrase. + public string ClusterPeeringPassphrase { get; } + + /// The vserver peering command. + public string VserverPeeringCommand { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PolicyState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PolicyState.cs new file mode 100644 index 000000000000..b48a3872eda0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PolicyState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Policy state. + public readonly partial struct PolicyState : IEquatable + { + private readonly string _value; + /// Value indicating the policy is enabled. + private const string EnabledValue = "Enabled"; + /// Value indicating the policy is disabled. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public PolicyState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Value indicating the policy is enabled. + public static PolicyState Enabled { get; } = new PolicyState(EnabledValue); + + /// Value indicating the policy is disabled. + public static PolicyState Disabled { get; } = new PolicyState(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(PolicyState left, PolicyState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(PolicyState left, PolicyState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator PolicyState(string value) => new PolicyState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator PolicyState?(string value) => value == null ? null : new PolicyState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyState other && Equals(other); + + /// + public bool Equals(PolicyState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PolicyStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PolicyStatus.cs new file mode 100644 index 000000000000..ecb37ec06ef6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PolicyStatus.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Policy status. + public readonly partial struct PolicyStatus : IEquatable + { + private readonly string _value; + /// Value indicating the policy is enabled. + private const string EnabledValue = "Enabled"; + /// Value indicating the policy is disabled. + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public PolicyStatus(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Value indicating the policy is enabled. + public static PolicyStatus Enabled { get; } = new PolicyStatus(EnabledValue); + + /// Value indicating the policy is disabled. + public static PolicyStatus Disabled { get; } = new PolicyStatus(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(PolicyStatus left, PolicyStatus right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(PolicyStatus left, PolicyStatus right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator PolicyStatus(string value) => new PolicyStatus(value); + + /// Converts a string to a . + /// The value. + public static implicit operator PolicyStatus?(string value) => value == null ? null : new PolicyStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyStatus other && Equals(other); + + /// + public bool Equals(PolicyStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolChangeRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolChangeRequest.Serialization.cs new file mode 100644 index 000000000000..320a03ef7aef --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolChangeRequest.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Pool change request. + public partial class PoolChangeRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal PoolChangeRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PoolChangeRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("newPoolResourceId"u8); + writer.WriteStringValue(NewPoolResourceId); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PoolChangeRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PoolChangeRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PoolChangeRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePoolChangeRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PoolChangeRequest DeserializePoolChangeRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string newPoolResourceId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("newPoolResourceId"u8)) + { + newPoolResourceId = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PoolChangeRequest(newPoolResourceId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(PoolChangeRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PoolChangeRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PoolChangeRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializePoolChangeRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PoolChangeRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(PoolChangeRequest poolChangeRequest) + { + if (poolChangeRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(poolChangeRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolChangeRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolChangeRequest.cs new file mode 100644 index 000000000000..5ccb0aa3fd54 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolChangeRequest.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Pool change request. + public partial class PoolChangeRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Resource id of the pool to move volume to. + /// is null. + public PoolChangeRequest(string newPoolResourceId) + { + Argument.AssertNotNull(newPoolResourceId, nameof(newPoolResourceId)); + + NewPoolResourceId = newPoolResourceId; + } + + /// Initializes a new instance of . + /// Resource id of the pool to move volume to. + /// Keeps track of any properties unknown to the library. + internal PoolChangeRequest(string newPoolResourceId, IDictionary additionalBinaryDataProperties) + { + NewPoolResourceId = newPoolResourceId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource id of the pool to move volume to. + public string NewPoolResourceId { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolPatchProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolPatchProperties.Serialization.cs new file mode 100644 index 000000000000..f846900066ff --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolPatchProperties.Serialization.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Patchable pool properties. + internal partial class PoolPatchProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PoolPatchProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(QosType)) + { + writer.WritePropertyName("qosType"u8); + writer.WriteStringValue(QosType.Value.ToString()); + } + if (Optional.IsDefined(CoolAccess)) + { + writer.WritePropertyName("coolAccess"u8); + writer.WriteBooleanValue(CoolAccess.Value); + } + if (Optional.IsDefined(CustomThroughputMibpsInt)) + { + writer.WritePropertyName("customThroughputMibps"u8); + writer.WriteNumberValue(CustomThroughputMibpsInt.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PoolPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PoolPatchProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PoolPatchProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePoolPatchProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PoolPatchProperties DeserializePoolPatchProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? size = default; + QosType? qosType = default; + bool? coolAccess = default; + int? customThroughputMibpsInt = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("size"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("qosType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + qosType = new QosType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("coolAccess"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coolAccess = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("customThroughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + customThroughputMibpsInt = null; + continue; + } + customThroughputMibpsInt = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PoolPatchProperties(size, qosType, coolAccess, customThroughputMibpsInt, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(PoolPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PoolPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PoolPatchProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializePoolPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PoolPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolPatchProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolPatchProperties.cs new file mode 100644 index 000000000000..5837b10d3f7d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolPatchProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Patchable pool properties. + internal partial class PoolPatchProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public PoolPatchProperties() + { + } + + /// Initializes a new instance of . + /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). + /// The qos type of the pool. + /// If enabled (true) the pool can contain cool Access enabled volumes. + /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. + /// Keeps track of any properties unknown to the library. + internal PoolPatchProperties(long? size, QosType? qosType, bool? coolAccess, int? customThroughputMibpsInt, IDictionary additionalBinaryDataProperties) + { + Size = size; + QosType = qosType; + CoolAccess = coolAccess; + CustomThroughputMibpsInt = customThroughputMibpsInt; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). + public long? Size { get; set; } + + /// The qos type of the pool. + public QosType? QosType { get; set; } + + /// If enabled (true) the pool can contain cool Access enabled volumes. + public bool? CoolAccess { get; set; } + + /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. + public int? CustomThroughputMibpsInt { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolProperties.Serialization.cs new file mode 100644 index 000000000000..65c33e30949d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolProperties.Serialization.cs @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Pool properties. + internal partial class PoolProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal PoolProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PoolProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(PoolId)) + { + writer.WritePropertyName("poolId"u8); + writer.WriteStringValue(PoolId); + } + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size); + writer.WritePropertyName("serviceLevel"u8); + writer.WriteStringValue(ServiceLevel.ToString()); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(TotalThroughputMibps)) + { + writer.WritePropertyName("totalThroughputMibps"u8); + writer.WriteNumberValue(TotalThroughputMibps.Value); + } + if (options.Format != "W" && Optional.IsDefined(UtilizedThroughputMibps)) + { + writer.WritePropertyName("utilizedThroughputMibps"u8); + writer.WriteNumberValue(UtilizedThroughputMibps.Value); + } + if (Optional.IsDefined(CustomThroughputMibps)) + { + writer.WritePropertyName("customThroughputMibps"u8); + writer.WriteNumberValue(CustomThroughputMibps.Value); + } + if (Optional.IsDefined(QosType)) + { + writer.WritePropertyName("qosType"u8); + writer.WriteStringValue(QosType.Value.ToString()); + } + if (Optional.IsDefined(CoolAccess)) + { + writer.WritePropertyName("coolAccess"u8); + writer.WriteBooleanValue(CoolAccess.Value); + } + if (Optional.IsDefined(EncryptionType)) + { + writer.WritePropertyName("encryptionType"u8); + writer.WriteStringValue(EncryptionType.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + PoolProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PoolProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PoolProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePoolProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PoolProperties DeserializePoolProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string poolId = default; + long size = default; + NetAppFileServiceLevel serviceLevel = default; + string provisioningState = default; + float? totalThroughputMibps = default; + float? utilizedThroughputMibps = default; + int? customThroughputMibps = default; + QosType? qosType = default; + bool? coolAccess = default; + CapacityPoolEncryptionType? encryptionType = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("poolId"u8)) + { + poolId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("size"u8)) + { + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("serviceLevel"u8)) + { + serviceLevel = new NetAppFileServiceLevel(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("totalThroughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + totalThroughputMibps = prop.Value.GetSingle(); + continue; + } + if (prop.NameEquals("utilizedThroughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + utilizedThroughputMibps = prop.Value.GetSingle(); + continue; + } + if (prop.NameEquals("customThroughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + customThroughputMibps = null; + continue; + } + customThroughputMibps = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("qosType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + qosType = new QosType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("coolAccess"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coolAccess = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("encryptionType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + encryptionType = null; + continue; + } + encryptionType = new CapacityPoolEncryptionType(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PoolProperties( + poolId, + size, + serviceLevel, + provisioningState, + totalThroughputMibps, + utilizedThroughputMibps, + customThroughputMibps, + qosType, + coolAccess, + encryptionType, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(PoolProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PoolProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PoolProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializePoolProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PoolProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolProperties.cs new file mode 100644 index 000000000000..c6fbaefa200d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/PoolProperties.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Pool properties. + internal partial class PoolProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). + /// The service level of the file system. + public PoolProperties(long size, NetAppFileServiceLevel serviceLevel) + { + Size = size; + ServiceLevel = serviceLevel; + } + + /// Initializes a new instance of . + /// UUID v4 used to identify the Pool. + /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). + /// The service level of the file system. + /// Azure lifecycle management. + /// Total throughput of pool in MiB/s. + /// Utilized throughput of pool in MiB/s. + /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. + /// The qos type of the pool. + /// If enabled (true) the pool can contain cool Access enabled volumes. + /// Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. + /// Keeps track of any properties unknown to the library. + internal PoolProperties(string poolId, long size, NetAppFileServiceLevel serviceLevel, string provisioningState, float? totalThroughputMibps, float? utilizedThroughputMibps, int? customThroughputMibps, QosType? qosType, bool? coolAccess, CapacityPoolEncryptionType? encryptionType, IDictionary additionalBinaryDataProperties) + { + PoolId = poolId; + Size = size; + ServiceLevel = serviceLevel; + ProvisioningState = provisioningState; + TotalThroughputMibps = totalThroughputMibps; + UtilizedThroughputMibps = utilizedThroughputMibps; + CustomThroughputMibps = customThroughputMibps; + QosType = qosType; + CoolAccess = coolAccess; + EncryptionType = encryptionType; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// UUID v4 used to identify the Pool. + public string PoolId { get; } + + /// Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiple of 1099511627776). + public long Size { get; set; } + + /// The service level of the file system. + public NetAppFileServiceLevel ServiceLevel { get; set; } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + + /// Total throughput of pool in MiB/s. + public float? TotalThroughputMibps { get; } + + /// Utilized throughput of pool in MiB/s. + public float? UtilizedThroughputMibps { get; } + + /// Maximum throughput in MiB/s that can be achieved by this pool and this will be accepted as input only for manual qosType pool with Flexible service level. + public int? CustomThroughputMibps { get; set; } + + /// The qos type of the pool. + public QosType? QosType { get; set; } + + /// If enabled (true) the pool can contain cool Access enabled volumes. + public bool? CoolAccess { get; set; } + + /// Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. + public CapacityPoolEncryptionType? EncryptionType { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ProtocolTypes.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ProtocolTypes.cs new file mode 100644 index 000000000000..567f2c18f7d9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ProtocolTypes.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Export policy rule. + public readonly partial struct ProtocolTypes : IEquatable + { + private readonly string _value; + /// NFSv3 protocol type. + private const string NFSv3Value = "NFSv3"; + /// NFSv4 protocol type. + private const string NFSv4Value = "NFSv4"; + /// SMB protocol type. + private const string SMBValue = "SMB"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ProtocolTypes(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// NFSv3 protocol type. + public static ProtocolTypes NFSv3 { get; } = new ProtocolTypes(NFSv3Value); + + /// NFSv4 protocol type. + public static ProtocolTypes NFSv4 { get; } = new ProtocolTypes(NFSv4Value); + + /// SMB protocol type. + public static ProtocolTypes SMB { get; } = new ProtocolTypes(SMBValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ProtocolTypes left, ProtocolTypes right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ProtocolTypes left, ProtocolTypes right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ProtocolTypes(string value) => new ProtocolTypes(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ProtocolTypes?(string value) => value == null ? null : new ProtocolTypes(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProtocolTypes other && Equals(other); + + /// + public bool Equals(ProtocolTypes other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QosType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QosType.cs new file mode 100644 index 000000000000..3f42293e923c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QosType.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The qos type of the pool. + public readonly partial struct QosType : IEquatable + { + private readonly string _value; + /// qos type Auto. + private const string AutoValue = "Auto"; + /// qos type Manual. + private const string ManualValue = "Manual"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public QosType(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// qos type Auto. + public static QosType Auto { get; } = new QosType(AutoValue); + + /// qos type Manual. + public static QosType Manual { get; } = new QosType(ManualValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(QosType left, QosType right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(QosType left, QosType right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator QosType(string value) => new QosType(value); + + /// Converts a string to a . + /// The value. + public static implicit operator QosType?(string value) => value == null ? null : new QosType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QosType other && Equals(other); + + /// + public bool Equals(QosType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetContent.Serialization.cs deleted file mode 100644 index d0969eed65ac..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetContent.Serialization.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class QueryNetworkSiblingSetContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QueryNetworkSiblingSetContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("networkSiblingSetId"u8); - writer.WriteStringValue(NetworkSiblingSetId); - writer.WritePropertyName("subnetId"u8); - writer.WriteStringValue(SubnetId); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - QueryNetworkSiblingSetContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(QueryNetworkSiblingSetContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeQueryNetworkSiblingSetContent(document.RootElement, options); - } - - internal static QueryNetworkSiblingSetContent DeserializeQueryNetworkSiblingSetContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string networkSiblingSetId = default; - ResourceIdentifier subnetId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("networkSiblingSetId"u8)) - { - networkSiblingSetId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subnetId"u8)) - { - subnetId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new QueryNetworkSiblingSetContent(networkSiblingSetId, subnetId, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(QueryNetworkSiblingSetContent)} does not support writing '{options.Format}' format."); - } - } - - QueryNetworkSiblingSetContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeQueryNetworkSiblingSetContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(QueryNetworkSiblingSetContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetRequest.Serialization.cs new file mode 100644 index 000000000000..90b07baa4f2f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetRequest.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Network sibling set query. + public partial class QueryNetworkSiblingSetRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal QueryNetworkSiblingSetRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QueryNetworkSiblingSetRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("networkSiblingSetId"u8); + writer.WriteStringValue(NetworkSiblingSetId); + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + QueryNetworkSiblingSetRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QueryNetworkSiblingSetRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QueryNetworkSiblingSetRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQueryNetworkSiblingSetRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QueryNetworkSiblingSetRequest DeserializeQueryNetworkSiblingSetRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string networkSiblingSetId = default; + ResourceIdentifier subnetId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("networkSiblingSetId"u8)) + { + networkSiblingSetId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("subnetId"u8)) + { + subnetId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new QueryNetworkSiblingSetRequest(networkSiblingSetId, subnetId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(QueryNetworkSiblingSetRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + QueryNetworkSiblingSetRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QueryNetworkSiblingSetRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeQueryNetworkSiblingSetRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QueryNetworkSiblingSetRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(QueryNetworkSiblingSetRequest queryNetworkSiblingSetRequest) + { + if (queryNetworkSiblingSetRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(queryNetworkSiblingSetRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetRequest.cs similarity index 53% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetContent.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetRequest.cs index 69512168ff81..74799c9e9616 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetContent.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QueryNetworkSiblingSetRequest.cs @@ -8,49 +8,21 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Network sibling set query. - public partial class QueryNetworkSiblingSetContent + public partial class QueryNetworkSiblingSetRequest { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. /// or is null. - public QueryNetworkSiblingSetContent(string networkSiblingSetId, ResourceIdentifier subnetId) + public QueryNetworkSiblingSetRequest(string networkSiblingSetId, ResourceIdentifier subnetId) { Argument.AssertNotNull(networkSiblingSetId, nameof(networkSiblingSetId)); Argument.AssertNotNull(subnetId, nameof(subnetId)); @@ -59,24 +31,20 @@ public QueryNetworkSiblingSetContent(string networkSiblingSetId, ResourceIdentif SubnetId = subnetId; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. - /// Keeps track of any properties unknown to the library. - internal QueryNetworkSiblingSetContent(string networkSiblingSetId, ResourceIdentifier subnetId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QueryNetworkSiblingSetRequest(string networkSiblingSetId, ResourceIdentifier subnetId, IDictionary additionalBinaryDataProperties) { NetworkSiblingSetId = networkSiblingSetId; SubnetId = subnetId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal QueryNetworkSiblingSetContent() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. public string NetworkSiblingSetId { get; } + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. public ResourceIdentifier SubnetId { get; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaAvailabilityRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaAvailabilityRequest.Serialization.cs new file mode 100644 index 000000000000..956b87b8c537 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaAvailabilityRequest.Serialization.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Quota availability request content. + public partial class QuotaAvailabilityRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal QuotaAvailabilityRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaAvailabilityRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + writer.WritePropertyName("resourceGroup"u8); + writer.WriteStringValue(ResourceGroup); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + QuotaAvailabilityRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuotaAvailabilityRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaAvailabilityRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaAvailabilityRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuotaAvailabilityRequest DeserializeQuotaAvailabilityRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + CheckQuotaNameResourceTypes @type = default; + string resourceGroup = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + @type = new CheckQuotaNameResourceTypes(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("resourceGroup"u8)) + { + resourceGroup = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new QuotaAvailabilityRequest(name, @type, resourceGroup, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(QuotaAvailabilityRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + QuotaAvailabilityRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuotaAvailabilityRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeQuotaAvailabilityRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuotaAvailabilityRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(QuotaAvailabilityRequest quotaAvailabilityRequest) + { + if (quotaAvailabilityRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(quotaAvailabilityRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaAvailabilityRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaAvailabilityRequest.cs new file mode 100644 index 000000000000..fcbe0cf27189 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaAvailabilityRequest.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Quota availability request content. + public partial class QuotaAvailabilityRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Name of the resource to verify. + /// Resource type used for verification. + /// Resource group name. + /// or is null. + public QuotaAvailabilityRequest(string name, CheckQuotaNameResourceTypes @type, string resourceGroup) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(resourceGroup, nameof(resourceGroup)); + + Name = name; + Type = @type; + ResourceGroup = resourceGroup; + } + + /// Initializes a new instance of . + /// Name of the resource to verify. + /// Resource type used for verification. + /// Resource group name. + /// Keeps track of any properties unknown to the library. + internal QuotaAvailabilityRequest(string name, CheckQuotaNameResourceTypes @type, string resourceGroup, IDictionary additionalBinaryDataProperties) + { + Name = name; + Type = @type; + ResourceGroup = resourceGroup; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Name of the resource to verify. + public string Name { get; } + + /// Resource type used for verification. + public CheckQuotaNameResourceTypes Type { get; } + + /// Resource group name. + public string ResourceGroup { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemList.Serialization.cs index f6c35a50347a..4fe008653a8d 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class QuotaItemList : IUtf8JsonSerializable, IJsonModel + /// List of Quota Items. + internal partial class QuotaItemList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal QuotaItemList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuotaItemList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (NetAppSubscriptionQuotaItemData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - QuotaItemList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + QuotaItemList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuotaItemList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(QuotaItemList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeQuotaItemList(document.RootElement, options); } - internal static QuotaItemList DeserializeQuotaItemList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuotaItemList DeserializeQuotaItemList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem(item, options)); + array.Add(NetAppSubscriptionQuotaItemData.DeserializeNetAppSubscriptionQuotaItemData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new QuotaItemList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new QuotaItemList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -133,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions optio } } - QuotaItemList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + QuotaItemList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuotaItemList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeQuotaItemList(document.RootElement, options); } default: @@ -149,6 +163,15 @@ QuotaItemList IPersistableModel.Create(BinaryData data, ModelRead } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static QuotaItemList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeQuotaItemList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemList.cs index 860c14af5a43..124dda1227ea 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of Quota Items. internal partial class QuotaItemList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal QuotaItemList() + /// The QuotaItem items on this page. + internal QuotaItemList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// A list of QuotaItems. - /// URL to get the next set of results. - /// Keeps track of any properties unknown to the library. - internal QuotaItemList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The QuotaItem items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal QuotaItemList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// A list of QuotaItems. - public IReadOnlyList Value { get; } - /// URL to get the next set of results. - public string NextLink { get; } + /// The QuotaItem items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemProperties.Serialization.cs new file mode 100644 index 000000000000..1b455efcdc3d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemProperties.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// QuotaItem Properties. + internal partial class QuotaItemProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaItemProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(Current)) + { + writer.WritePropertyName("current"u8); + writer.WriteNumberValue(Current.Value); + } + if (options.Format != "W" && Optional.IsDefined(Default)) + { + writer.WritePropertyName("default"u8); + writer.WriteNumberValue(Default.Value); + } + if (options.Format != "W" && Optional.IsDefined(Usage)) + { + writer.WritePropertyName("usage"u8); + writer.WriteNumberValue(Usage.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + QuotaItemProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuotaItemProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaItemProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaItemProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuotaItemProperties DeserializeQuotaItemProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? current = default; + int? @default = default; + int? usage = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("current"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + current = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("default"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + @default = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("usage"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + usage = null; + continue; + } + usage = prop.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new QuotaItemProperties(current, @default, usage, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(QuotaItemProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + QuotaItemProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuotaItemProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeQuotaItemProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuotaItemProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemProperties.cs new file mode 100644 index 000000000000..26368c9a2cb7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaItemProperties.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// QuotaItem Properties. + internal partial class QuotaItemProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal QuotaItemProperties() + { + } + + /// Initializes a new instance of . + /// The current quota value. + /// The default quota value. + /// The usage quota value. + /// Keeps track of any properties unknown to the library. + internal QuotaItemProperties(int? current, int? @default, int? usage, IDictionary additionalBinaryDataProperties) + { + Current = current; + Default = @default; + Usage = usage; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The current quota value. + public int? Current { get; } + + /// The default quota value. + public int? Default { get; } + + /// The usage quota value. + public int? Usage { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaReport.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaReport.Serialization.cs new file mode 100644 index 000000000000..eca2ab92faf5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaReport.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Quota report record properties. + public partial class QuotaReport : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaReport)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(QuotaType)) + { + writer.WritePropertyName("quotaType"u8); + writer.WriteStringValue(QuotaType.Value.ToString()); + } + if (Optional.IsDefined(QuotaTarget)) + { + writer.WritePropertyName("quotaTarget"u8); + writer.WriteStringValue(QuotaTarget); + } + if (Optional.IsDefined(QuotaLimitUsedInKiBs)) + { + writer.WritePropertyName("quotaLimitUsedInKiBs"u8); + writer.WriteNumberValue(QuotaLimitUsedInKiBs.Value); + } + if (Optional.IsDefined(QuotaLimitTotalInKiBs)) + { + writer.WritePropertyName("quotaLimitTotalInKiBs"u8); + writer.WriteNumberValue(QuotaLimitTotalInKiBs.Value); + } + if (Optional.IsDefined(PercentageUsed)) + { + writer.WritePropertyName("percentageUsed"u8); + writer.WriteNumberValue(PercentageUsed.Value); + } + if (Optional.IsDefined(IsDerivedQuota)) + { + writer.WritePropertyName("isDerivedQuota"u8); + writer.WriteBooleanValue(IsDerivedQuota.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + QuotaReport IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual QuotaReport JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuotaReport)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaReport(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static QuotaReport DeserializeQuotaReport(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Type? quotaType = default; + string quotaTarget = default; + long? quotaLimitUsedInKiBs = default; + long? quotaLimitTotalInKiBs = default; + float? percentageUsed = default; + bool? isDerivedQuota = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("quotaType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quotaType = new Type(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("quotaTarget"u8)) + { + quotaTarget = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("quotaLimitUsedInKiBs"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quotaLimitUsedInKiBs = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("quotaLimitTotalInKiBs"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quotaLimitTotalInKiBs = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("percentageUsed"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentageUsed = prop.Value.GetSingle(); + continue; + } + if (prop.NameEquals("isDerivedQuota"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDerivedQuota = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new QuotaReport( + quotaType, + quotaTarget, + quotaLimitUsedInKiBs, + quotaLimitTotalInKiBs, + percentageUsed, + isDerivedQuota, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(QuotaReport)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + QuotaReport IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual QuotaReport PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeQuotaReport(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuotaReport)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReport.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaReport.cs similarity index 52% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReport.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaReport.cs index ce36162cbb06..60581917d549 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeQuotaReport.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/QuotaReport.cs @@ -11,54 +11,25 @@ namespace Azure.ResourceManager.NetApp.Models { /// Quota report record properties. - public partial class NetAppVolumeQuotaReport + public partial class QuotaReport { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; - /// Initializes a new instance of . - internal NetAppVolumeQuotaReport() + /// Initializes a new instance of . + internal QuotaReport() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Type of quota. /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. /// Specifies the current usage in kibibytes for the user/group quota. /// Specifies the total size limit in kibibytes for the user/group quota. /// Percentage of used size compared to total size. /// Flag to indicate whether the quota is derived from default quota. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeQuotaReport(NetAppVolumeQuotaType? quotaType, string quotaTarget, long? quotaLimitUsedInKiBs, long? quotaLimitTotalInKiBs, float? percentageUsed, bool? isDerivedQuota, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal QuotaReport(Type? quotaType, string quotaTarget, long? quotaLimitUsedInKiBs, long? quotaLimitTotalInKiBs, float? percentageUsed, bool? isDerivedQuota, IDictionary additionalBinaryDataProperties) { QuotaType = quotaType; QuotaTarget = quotaTarget; @@ -66,19 +37,24 @@ internal NetAppVolumeQuotaReport(NetAppVolumeQuotaType? quotaType, string quotaT QuotaLimitTotalInKiBs = quotaLimitTotalInKiBs; PercentageUsed = percentageUsed; IsDerivedQuota = isDerivedQuota; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Type of quota. - public NetAppVolumeQuotaType? QuotaType { get; } + public Type? QuotaType { get; } + /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. public string QuotaTarget { get; } + /// Specifies the current usage in kibibytes for the user/group quota. public long? QuotaLimitUsedInKiBs { get; } + /// Specifies the total size limit in kibibytes for the user/group quota. public long? QuotaLimitTotalInKiBs { get; } + /// Percentage of used size compared to total size. public float? PercentageUsed { get; } + /// Flag to indicate whether the quota is derived from default quota. public bool? IsDerivedQuota { get; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionPatchSettings.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionPatchSettings.Serialization.cs new file mode 100644 index 000000000000..072883bc431d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionPatchSettings.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Advanced Ransomware Protection reports (ARP) updatable settings. + internal partial class RansomwareProtectionPatchSettings : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareProtectionPatchSettings)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(DesiredRansomwareProtectionState)) + { + writer.WritePropertyName("desiredRansomwareProtectionState"u8); + writer.WriteStringValue(DesiredRansomwareProtectionState.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + RansomwareProtectionPatchSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual RansomwareProtectionPatchSettings JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareProtectionPatchSettings)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRansomwareProtectionPatchSettings(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RansomwareProtectionPatchSettings DeserializeRansomwareProtectionPatchSettings(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DesiredRansomwareProtectionState? desiredRansomwareProtectionState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("desiredRansomwareProtectionState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desiredRansomwareProtectionState = new DesiredRansomwareProtectionState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new RansomwareProtectionPatchSettings(desiredRansomwareProtectionState, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(RansomwareProtectionPatchSettings)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + RansomwareProtectionPatchSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RansomwareProtectionPatchSettings PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeRansomwareProtectionPatchSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RansomwareProtectionPatchSettings)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionPatchSettings.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionPatchSettings.cs new file mode 100644 index 000000000000..f17762449638 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionPatchSettings.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Advanced Ransomware Protection reports (ARP) updatable settings. + internal partial class RansomwareProtectionPatchSettings + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public RansomwareProtectionPatchSettings() + { + } + + /// Initializes a new instance of . + /// The desired value of the ARP feature state available to the volume. + /// Keeps track of any properties unknown to the library. + internal RansomwareProtectionPatchSettings(DesiredRansomwareProtectionState? desiredRansomwareProtectionState, IDictionary additionalBinaryDataProperties) + { + DesiredRansomwareProtectionState = desiredRansomwareProtectionState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The desired value of the ARP feature state available to the volume. + public DesiredRansomwareProtectionState? DesiredRansomwareProtectionState { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionSettings.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionSettings.Serialization.cs new file mode 100644 index 000000000000..a4bcf1d86dbe --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionSettings.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Advanced Ransomware Protection reports (ARP) settings. + public partial class RansomwareProtectionSettings : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareProtectionSettings)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(DesiredRansomwareProtectionState)) + { + writer.WritePropertyName("desiredRansomwareProtectionState"u8); + writer.WriteStringValue(DesiredRansomwareProtectionState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ActualRansomwareProtectionState)) + { + writer.WritePropertyName("actualRansomwareProtectionState"u8); + writer.WriteStringValue(ActualRansomwareProtectionState.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + RansomwareProtectionSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual RansomwareProtectionSettings JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareProtectionSettings)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRansomwareProtectionSettings(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RansomwareProtectionSettings DeserializeRansomwareProtectionSettings(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DesiredRansomwareProtectionState? desiredRansomwareProtectionState = default; + ActualRansomwareProtectionState? actualRansomwareProtectionState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("desiredRansomwareProtectionState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desiredRansomwareProtectionState = new DesiredRansomwareProtectionState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("actualRansomwareProtectionState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + actualRansomwareProtectionState = new ActualRansomwareProtectionState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new RansomwareProtectionSettings(desiredRansomwareProtectionState, actualRansomwareProtectionState, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(RansomwareProtectionSettings)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + RansomwareProtectionSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RansomwareProtectionSettings PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeRansomwareProtectionSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RansomwareProtectionSettings)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionSettings.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionSettings.cs new file mode 100644 index 000000000000..4db19868b6cd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareProtectionSettings.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Advanced Ransomware Protection reports (ARP) settings. + public partial class RansomwareProtectionSettings + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public RansomwareProtectionSettings() + { + } + + /// Initializes a new instance of . + /// The desired value of the Advanced Ransomware Protection feature state available to the volume. + /// The actual state of the Advanced Ransomware Protection feature currently active on the volume. + /// Keeps track of any properties unknown to the library. + internal RansomwareProtectionSettings(DesiredRansomwareProtectionState? desiredRansomwareProtectionState, ActualRansomwareProtectionState? actualRansomwareProtectionState, IDictionary additionalBinaryDataProperties) + { + DesiredRansomwareProtectionState = desiredRansomwareProtectionState; + ActualRansomwareProtectionState = actualRansomwareProtectionState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The desired value of the Advanced Ransomware Protection feature state available to the volume. + public DesiredRansomwareProtectionState? DesiredRansomwareProtectionState { get; set; } + + /// The actual state of the Advanced Ransomware Protection feature currently active on the volume. + public ActualRansomwareProtectionState? ActualRansomwareProtectionState { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportProperties.Serialization.cs new file mode 100644 index 000000000000..9d1fa8e58df0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportProperties.Serialization.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// + /// Advanced Ransomware Protection (ARP) report properties. + /// + /// Evaluate the report to determine whether the activity is acceptable (false positive) or whether an attack seems malicious using the ClearSuspects operation. + /// + /// Advanced Ransomware Protection (ARP) creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of the ARP snapshots or another snapshot of your volume to restore data. + /// + public partial class RansomwareReportProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareReportProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(EventOn)) + { + writer.WritePropertyName("eventTime"u8); + writer.WriteStringValue(EventOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Severity)) + { + writer.WritePropertyName("severity"u8); + writer.WriteStringValue(Severity.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ClearedCount)) + { + writer.WritePropertyName("clearedCount"u8); + writer.WriteNumberValue(ClearedCount.Value); + } + if (options.Format != "W" && Optional.IsDefined(ReportedCount)) + { + writer.WritePropertyName("reportedCount"u8); + writer.WriteNumberValue(ReportedCount.Value); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Suspects)) + { + writer.WritePropertyName("suspects"u8); + writer.WriteStartArray(); + foreach (RansomwareSuspects item in Suspects) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + RansomwareReportProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual RansomwareReportProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareReportProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRansomwareReportProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RansomwareReportProperties DeserializeRansomwareReportProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? eventOn = default; + RansomwareReportState? state = default; + RansomwareReportSeverity? severity = default; + int? clearedCount = default; + int? reportedCount = default; + IReadOnlyList suspects = default; + string provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("eventTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eventOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("state"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new RansomwareReportState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("severity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + severity = new RansomwareReportSeverity(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("clearedCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clearedCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("reportedCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reportedCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("suspects"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(RansomwareSuspects.DeserializeRansomwareSuspects(item, options)); + } + suspects = array; + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new RansomwareReportProperties( + eventOn, + state, + severity, + clearedCount, + reportedCount, + suspects ?? new ChangeTrackingList(), + provisioningState, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(RansomwareReportProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + RansomwareReportProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RansomwareReportProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeRansomwareReportProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RansomwareReportProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportProperties.cs new file mode 100644 index 000000000000..2c87e6ea13ff --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportProperties.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// + /// Advanced Ransomware Protection (ARP) report properties. + /// + /// Evaluate the report to determine whether the activity is acceptable (false positive) or whether an attack seems malicious using the ClearSuspects operation. + /// + /// Advanced Ransomware Protection (ARP) creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of the ARP snapshots or another snapshot of your volume to restore data. + /// + public partial class RansomwareReportProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal RansomwareReportProperties() + { + Suspects = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The creation date and time of the report. + /// State of the Advanced Ransomware Protection (ARP) report. + /// Severity of the Advanced Ransomware Protection (ARP) report. + /// The number of cleared suspects identified by the ARP report. + /// The number of suspects identified by the ARP report. + /// Suspects identified in an ARP report. + /// Azure lifecycle management. + /// Keeps track of any properties unknown to the library. + internal RansomwareReportProperties(DateTimeOffset? eventOn, RansomwareReportState? state, RansomwareReportSeverity? severity, int? clearedCount, int? reportedCount, IReadOnlyList suspects, string provisioningState, IDictionary additionalBinaryDataProperties) + { + EventOn = eventOn; + State = state; + Severity = severity; + ClearedCount = clearedCount; + ReportedCount = reportedCount; + Suspects = suspects; + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The creation date and time of the report. + public DateTimeOffset? EventOn { get; } + + /// State of the Advanced Ransomware Protection (ARP) report. + public RansomwareReportState? State { get; } + + /// Severity of the Advanced Ransomware Protection (ARP) report. + public RansomwareReportSeverity? Severity { get; } + + /// The number of cleared suspects identified by the ARP report. + public int? ClearedCount { get; } + + /// The number of suspects identified by the ARP report. + public int? ReportedCount { get; } + + /// Suspects identified in an ARP report. + public IReadOnlyList Suspects { get; } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportSeverity.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportSeverity.cs new file mode 100644 index 000000000000..f7fdaeb0d86e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportSeverity.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Severity of the Advanced Ransomware Protection (ARP) report. + public readonly partial struct RansomwareReportSeverity : IEquatable + { + private readonly string _value; + /// No data is suspected for ransomware activity. + private const string NoneValue = "None"; + /// Low attack probability. + private const string LowValue = "Low"; + /// Moderate attack probability. + private const string ModerateValue = "Moderate"; + /// High amount of data is suspected for ransomware activity. + private const string HighValue = "High"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public RansomwareReportSeverity(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// No data is suspected for ransomware activity. + public static RansomwareReportSeverity None { get; } = new RansomwareReportSeverity(NoneValue); + + /// Low attack probability. + public static RansomwareReportSeverity Low { get; } = new RansomwareReportSeverity(LowValue); + + /// Moderate attack probability. + public static RansomwareReportSeverity Moderate { get; } = new RansomwareReportSeverity(ModerateValue); + + /// High amount of data is suspected for ransomware activity. + public static RansomwareReportSeverity High { get; } = new RansomwareReportSeverity(HighValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(RansomwareReportSeverity left, RansomwareReportSeverity right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(RansomwareReportSeverity left, RansomwareReportSeverity right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator RansomwareReportSeverity(string value) => new RansomwareReportSeverity(value); + + /// Converts a string to a . + /// The value. + public static implicit operator RansomwareReportSeverity?(string value) => value == null ? null : new RansomwareReportSeverity(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RansomwareReportSeverity other && Equals(other); + + /// + public bool Equals(RansomwareReportSeverity other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportState.cs new file mode 100644 index 000000000000..d0a35cc63a22 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// State of the Advanced Ransomware Protection (ARP) report. + public readonly partial struct RansomwareReportState : IEquatable + { + private readonly string _value; + /// The ARP report has been created. Take action by running clearsuspects marking suspects as FalsePositive or PotentialThreats. + private const string ActiveValue = "Active"; + /// The ARP Report has been resolved. + private const string ResolvedValue = "Resolved"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public RansomwareReportState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// The ARP report has been created. Take action by running clearsuspects marking suspects as FalsePositive or PotentialThreats. + public static RansomwareReportState Active { get; } = new RansomwareReportState(ActiveValue); + + /// The ARP Report has been resolved. + public static RansomwareReportState Resolved { get; } = new RansomwareReportState(ResolvedValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(RansomwareReportState left, RansomwareReportState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(RansomwareReportState left, RansomwareReportState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator RansomwareReportState(string value) => new RansomwareReportState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator RansomwareReportState?(string value) => value == null ? null : new RansomwareReportState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RansomwareReportState other && Equals(other); + + /// + public bool Equals(RansomwareReportState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportsList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportsList.Serialization.cs new file mode 100644 index 000000000000..2c22a3efe71c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportsList.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// List of Advanced Ransomware Protection (ARP) reports. + internal partial class RansomwareReportsList : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal RansomwareReportsList() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareReportsList)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (RansomwareReportData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + RansomwareReportsList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual RansomwareReportsList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareReportsList)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRansomwareReportsList(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RansomwareReportsList DeserializeRansomwareReportsList(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(RansomwareReportData.DeserializeRansomwareReportData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new RansomwareReportsList(value, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(RansomwareReportsList)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + RansomwareReportsList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RansomwareReportsList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeRansomwareReportsList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RansomwareReportsList)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static RansomwareReportsList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeRansomwareReportsList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportsList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportsList.cs new file mode 100644 index 000000000000..c581bf5284f5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareReportsList.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// List of Advanced Ransomware Protection (ARP) reports. + internal partial class RansomwareReportsList + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The RansomwareReport items on this page. + internal RansomwareReportsList(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The RansomwareReport items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal RansomwareReportsList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The RansomwareReport items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectResolution.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectResolution.cs new file mode 100644 index 000000000000..115f08cc5807 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectResolution.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// ARP report suspect resolution. + public readonly partial struct RansomwareSuspectResolution : IEquatable + { + private readonly string _value; + /// The identified file type is unexpected in your workload and should be treated as a potential attack. + private const string PotentialThreatValue = "PotentialThreat"; + /// The identified file type is expected in your workload and can be ignored. + private const string FalsePositiveValue = "FalsePositive"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public RansomwareSuspectResolution(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// The identified file type is unexpected in your workload and should be treated as a potential attack. + public static RansomwareSuspectResolution PotentialThreat { get; } = new RansomwareSuspectResolution(PotentialThreatValue); + + /// The identified file type is expected in your workload and can be ignored. + public static RansomwareSuspectResolution FalsePositive { get; } = new RansomwareSuspectResolution(FalsePositiveValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(RansomwareSuspectResolution left, RansomwareSuspectResolution right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(RansomwareSuspectResolution left, RansomwareSuspectResolution right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator RansomwareSuspectResolution(string value) => new RansomwareSuspectResolution(value); + + /// Converts a string to a . + /// The value. + public static implicit operator RansomwareSuspectResolution?(string value) => value == null ? null : new RansomwareSuspectResolution(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RansomwareSuspectResolution other && Equals(other); + + /// + public bool Equals(RansomwareSuspectResolution other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspects.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspects.Serialization.cs new file mode 100644 index 000000000000..9f62cc18e39c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspects.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// List of suspects identified in an Advanced Ransomware Protection (ARP) report. + public partial class RansomwareSuspects : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareSuspects)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(Extension)) + { + writer.WritePropertyName("extension"u8); + writer.WriteStringValue(Extension); + } + if (options.Format != "W" && Optional.IsDefined(Resolution)) + { + writer.WritePropertyName("resolution"u8); + writer.WriteStringValue(Resolution.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(FileCount)) + { + writer.WritePropertyName("fileCount"u8); + writer.WriteNumberValue(FileCount.Value); + } + if (options.Format != "W" && Optional.IsCollectionDefined(SuspectFiles)) + { + writer.WritePropertyName("suspectFiles"u8); + writer.WriteStartArray(); + foreach (SuspectFile item in SuspectFiles) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + RansomwareSuspects IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual RansomwareSuspects JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareSuspects)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRansomwareSuspects(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RansomwareSuspects DeserializeRansomwareSuspects(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string extension = default; + RansomwareSuspectResolution? resolution = default; + int? fileCount = default; + IReadOnlyList suspectFiles = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("extension"u8)) + { + extension = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("resolution"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resolution = new RansomwareSuspectResolution(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("fileCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("suspectFiles"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(SuspectFile.DeserializeSuspectFile(item, options)); + } + suspectFiles = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new RansomwareSuspects(extension, resolution, fileCount, suspectFiles ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(RansomwareSuspects)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + RansomwareSuspects IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RansomwareSuspects PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeRansomwareSuspects(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RansomwareSuspects)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspects.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspects.cs new file mode 100644 index 000000000000..b061984c3878 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspects.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// List of suspects identified in an Advanced Ransomware Protection (ARP) report. + public partial class RansomwareSuspects + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal RansomwareSuspects() + { + SuspectFiles = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Suspect File extension. + /// ARP report suspect resolution. + /// The number of suspect files at the time of ARP report, this number can change as files get created and report status progresses. + /// Suspect files. + /// Keeps track of any properties unknown to the library. + internal RansomwareSuspects(string extension, RansomwareSuspectResolution? resolution, int? fileCount, IReadOnlyList suspectFiles, IDictionary additionalBinaryDataProperties) + { + Extension = extension; + Resolution = resolution; + FileCount = fileCount; + SuspectFiles = suspectFiles; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Suspect File extension. + public string Extension { get; } + + /// ARP report suspect resolution. + public RansomwareSuspectResolution? Resolution { get; } + + /// The number of suspect files at the time of ARP report, this number can change as files get created and report status progresses. + public int? FileCount { get; } + + /// Suspect files. + public IReadOnlyList SuspectFiles { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectsClearRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectsClearRequest.Serialization.cs new file mode 100644 index 000000000000..82107e2e18b1 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectsClearRequest.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Clear suspects for Advanced Ransomware Protection (ARP) report. + public partial class RansomwareSuspectsClearRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal RansomwareSuspectsClearRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareSuspectsClearRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("resolution"u8); + writer.WriteStringValue(Resolution.ToString()); + writer.WritePropertyName("extensions"u8); + writer.WriteStartArray(); + foreach (string item in Extensions) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + RansomwareSuspectsClearRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual RansomwareSuspectsClearRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareSuspectsClearRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRansomwareSuspectsClearRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RansomwareSuspectsClearRequest DeserializeRansomwareSuspectsClearRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RansomwareSuspectResolution resolution = default; + IList extensions = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("resolution"u8)) + { + resolution = new RansomwareSuspectResolution(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("extensions"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + extensions = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new RansomwareSuspectsClearRequest(resolution, extensions, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(RansomwareSuspectsClearRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + RansomwareSuspectsClearRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RansomwareSuspectsClearRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeRansomwareSuspectsClearRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RansomwareSuspectsClearRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(RansomwareSuspectsClearRequest ransomwareSuspectsClearRequest) + { + if (ransomwareSuspectsClearRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(ransomwareSuspectsClearRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectsClearRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectsClearRequest.cs new file mode 100644 index 000000000000..4fb6ce382088 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RansomwareSuspectsClearRequest.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Clear suspects for Advanced Ransomware Protection (ARP) report. + public partial class RansomwareSuspectsClearRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// ARP report suspect resolution. + /// List of file extensions resolved (PotentialThreat or FalsePositive). + /// is null. + public RansomwareSuspectsClearRequest(RansomwareSuspectResolution resolution, IEnumerable extensions) + { + Argument.AssertNotNull(extensions, nameof(extensions)); + + Resolution = resolution; + Extensions = extensions.ToList(); + } + + /// Initializes a new instance of . + /// ARP report suspect resolution. + /// List of file extensions resolved (PotentialThreat or FalsePositive). + /// Keeps track of any properties unknown to the library. + internal RansomwareSuspectsClearRequest(RansomwareSuspectResolution resolution, IList extensions, IDictionary additionalBinaryDataProperties) + { + Resolution = resolution; + Extensions = extensions; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// ARP report suspect resolution. + public RansomwareSuspectResolution Resolution { get; } + + /// List of file extensions resolved (PotentialThreat or FalsePositive). + public IList Extensions { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReestablishReplicationRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReestablishReplicationRequest.Serialization.cs new file mode 100644 index 000000000000..2fe5071a0d22 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReestablishReplicationRequest.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Re-establish request object supplied in the body of the operation. + public partial class ReestablishReplicationRequest : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ReestablishReplicationRequest)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SourceVolumeId)) + { + writer.WritePropertyName("sourceVolumeId"u8); + writer.WriteStringValue(SourceVolumeId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ReestablishReplicationRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ReestablishReplicationRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ReestablishReplicationRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeReestablishReplicationRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ReestablishReplicationRequest DeserializeReestablishReplicationRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string sourceVolumeId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("sourceVolumeId"u8)) + { + sourceVolumeId = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ReestablishReplicationRequest(sourceVolumeId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ReestablishReplicationRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ReestablishReplicationRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ReestablishReplicationRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeReestablishReplicationRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ReestablishReplicationRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ReestablishReplicationRequest reestablishReplicationRequest) + { + if (reestablishReplicationRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(reestablishReplicationRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReestablishReplicationRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReestablishReplicationRequest.cs new file mode 100644 index 000000000000..b78f29e41a24 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReestablishReplicationRequest.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Re-establish request object supplied in the body of the operation. + public partial class ReestablishReplicationRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ReestablishReplicationRequest() + { + } + + /// Initializes a new instance of . + /// Resource id of the source volume for the replication. + /// Keeps track of any properties unknown to the library. + internal ReestablishReplicationRequest(string sourceVolumeId, IDictionary additionalBinaryDataProperties) + { + SourceVolumeId = sourceVolumeId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource id of the source volume for the replication. + public string SourceVolumeId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfo.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfo.Serialization.cs new file mode 100644 index 000000000000..b44385a2ddca --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfo.Serialization.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Provides region specific information. + public partial class RegionInfo : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegionInfo)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(StorageToNetworkProximity)) + { + writer.WritePropertyName("storageToNetworkProximity"u8); + writer.WriteStringValue(StorageToNetworkProximity.Value.ToString()); + } + if (Optional.IsCollectionDefined(AvailabilityZoneMappings)) + { + writer.WritePropertyName("availabilityZoneMappings"u8); + writer.WriteStartArray(); + foreach (AvailabilityZoneMapping item in AvailabilityZoneMappings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + RegionInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual RegionInfo JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegionInfo)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRegionInfo(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RegionInfo DeserializeRegionInfo(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RegionStorageToNetworkProximity? storageToNetworkProximity = default; + IList availabilityZoneMappings = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("storageToNetworkProximity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageToNetworkProximity = new RegionStorageToNetworkProximity(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("availabilityZoneMappings"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(AvailabilityZoneMapping.DeserializeAvailabilityZoneMapping(item, options)); + } + availabilityZoneMappings = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new RegionInfo(storageToNetworkProximity, availabilityZoneMappings ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(RegionInfo)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + RegionInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RegionInfo PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeRegionInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RegionInfo)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static RegionInfo FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeRegionInfo(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfo.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfo.cs new file mode 100644 index 000000000000..fd828d6fb7c8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfo.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Provides region specific information. + public partial class RegionInfo + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal RegionInfo() + { + AvailabilityZoneMappings = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Provides storage to network proximity information in the region. + /// Provides logical availability zone mappings for the subscription for a region. + /// Keeps track of any properties unknown to the library. + internal RegionInfo(RegionStorageToNetworkProximity? storageToNetworkProximity, IList availabilityZoneMappings, IDictionary additionalBinaryDataProperties) + { + StorageToNetworkProximity = storageToNetworkProximity; + AvailabilityZoneMappings = availabilityZoneMappings; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Provides storage to network proximity information in the region. + public RegionStorageToNetworkProximity? StorageToNetworkProximity { get; } + + /// Provides logical availability zone mappings for the subscription for a region. + public IList AvailabilityZoneMappings { get; } = new ChangeTrackingList(); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfosList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfosList.Serialization.cs deleted file mode 100644 index 0276919a3ccf..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfosList.Serialization.cs +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - internal partial class RegionInfosList : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RegionInfosList)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Value)) - { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(NextLink)) - { - writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RegionInfosList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RegionInfosList)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRegionInfosList(document.RootElement, options); - } - - internal static RegionInfosList DeserializeRegionInfosList(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RegionInfoResourceData.DeserializeRegionInfoResourceData(item, options)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RegionInfosList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(RegionInfosList)} does not support writing '{options.Format}' format."); - } - } - - RegionInfosList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRegionInfosList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RegionInfosList)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfosList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfosList.cs deleted file mode 100644 index 3969ced7df9f..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionInfosList.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// List of regionInfo resources. - internal partial class RegionInfosList - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal RegionInfosList() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// A list of regionInfo resources. - /// URL to get the next set of results. - /// Keeps track of any properties unknown to the library. - internal RegionInfosList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A list of regionInfo resources. - public IReadOnlyList Value { get; } - /// URL to get the next set of results. - public string NextLink { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionStorageToNetworkProximity.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionStorageToNetworkProximity.cs index 97a3d752be2a..08c20bb21111 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionStorageToNetworkProximity.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RegionStorageToNetworkProximity.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,56 +15,87 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct RegionStorageToNetworkProximity : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RegionStorageToNetworkProximity(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - + /// Basic network connectivity. private const string DefaultValue = "Default"; + /// Standard T1 network connectivity. private const string T1Value = "T1"; + /// Standard T2 network connectivity. private const string T2Value = "T2"; + /// Standard AcrossT2 network connectivity. private const string AcrossT2Value = "AcrossT2"; + /// Standard T1 and T2 network connectivity. private const string T1AndT2Value = "T1AndT2"; + /// Standard T1 and AcrossT2 network connectivity. private const string T1AndAcrossT2Value = "T1AndAcrossT2"; + /// Standard T2 and AcrossT2 network connectivity. private const string T2AndAcrossT2Value = "T2AndAcrossT2"; + /// Standard T1, T2 and AcrossT2 network connectivity. private const string T1AndT2AndAcrossT2Value = "T1AndT2AndAcrossT2"; + /// Initializes a new instance of . + /// The value. + /// is null. + public RegionStorageToNetworkProximity(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + /// Basic network connectivity. public static RegionStorageToNetworkProximity Default { get; } = new RegionStorageToNetworkProximity(DefaultValue); + /// Standard T1 network connectivity. public static RegionStorageToNetworkProximity T1 { get; } = new RegionStorageToNetworkProximity(T1Value); + /// Standard T2 network connectivity. public static RegionStorageToNetworkProximity T2 { get; } = new RegionStorageToNetworkProximity(T2Value); + /// Standard AcrossT2 network connectivity. public static RegionStorageToNetworkProximity AcrossT2 { get; } = new RegionStorageToNetworkProximity(AcrossT2Value); + /// Standard T1 and T2 network connectivity. public static RegionStorageToNetworkProximity T1AndT2 { get; } = new RegionStorageToNetworkProximity(T1AndT2Value); + /// Standard T1 and AcrossT2 network connectivity. public static RegionStorageToNetworkProximity T1AndAcrossT2 { get; } = new RegionStorageToNetworkProximity(T1AndAcrossT2Value); + /// Standard T2 and AcrossT2 network connectivity. public static RegionStorageToNetworkProximity T2AndAcrossT2 { get; } = new RegionStorageToNetworkProximity(T2AndAcrossT2Value); + /// Standard T1, T2 and AcrossT2 network connectivity. public static RegionStorageToNetworkProximity T1AndT2AndAcrossT2 { get; } = new RegionStorageToNetworkProximity(T1AndT2AndAcrossT2Value); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(RegionStorageToNetworkProximity left, RegionStorageToNetworkProximity right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(RegionStorageToNetworkProximity left, RegionStorageToNetworkProximity right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator RegionStorageToNetworkProximity(string value) => new RegionStorageToNetworkProximity(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator RegionStorageToNetworkProximity?(string value) => value == null ? null : new RegionStorageToNetworkProximity(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is RegionStorageToNetworkProximity other && Equals(other); - /// + + /// public bool Equals(RegionStorageToNetworkProximity other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeContent.Serialization.cs deleted file mode 100644 index 548f6dbe2217..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeContent.Serialization.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class RelocateVolumeContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RelocateVolumeContent)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(CreationToken)) - { - writer.WritePropertyName("creationToken"u8); - writer.WriteStringValue(CreationToken); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RelocateVolumeContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RelocateVolumeContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRelocateVolumeContent(document.RootElement, options); - } - - internal static RelocateVolumeContent DeserializeRelocateVolumeContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string creationToken = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("creationToken"u8)) - { - creationToken = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RelocateVolumeContent(creationToken, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(RelocateVolumeContent)} does not support writing '{options.Format}' format."); - } - } - - RelocateVolumeContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRelocateVolumeContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RelocateVolumeContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeContent.cs deleted file mode 100644 index 37b16580a063..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeContent.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Relocate volume request. - public partial class RelocateVolumeContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public RelocateVolumeContent() - { - } - - /// Initializes a new instance of . - /// New creation token for the volume that controls the mount point name. - /// Keeps track of any properties unknown to the library. - internal RelocateVolumeContent(string creationToken, IDictionary serializedAdditionalRawData) - { - CreationToken = creationToken; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// New creation token for the volume that controls the mount point name. - public string CreationToken { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeRequest.Serialization.cs new file mode 100644 index 000000000000..fe1f8fe79be3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeRequest.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Relocate volume request. + public partial class RelocateVolumeRequest : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RelocateVolumeRequest)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(CreationToken)) + { + writer.WritePropertyName("creationToken"u8); + writer.WriteStringValue(CreationToken); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + RelocateVolumeRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual RelocateVolumeRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RelocateVolumeRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRelocateVolumeRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RelocateVolumeRequest DeserializeRelocateVolumeRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string creationToken = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("creationToken"u8)) + { + creationToken = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new RelocateVolumeRequest(creationToken, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(RelocateVolumeRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + RelocateVolumeRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RelocateVolumeRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeRelocateVolumeRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RelocateVolumeRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(RelocateVolumeRequest relocateVolumeRequest) + { + if (relocateVolumeRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(relocateVolumeRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeRequest.cs new file mode 100644 index 000000000000..888bd553825e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RelocateVolumeRequest.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Relocate volume request. + public partial class RelocateVolumeRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public RelocateVolumeRequest() + { + } + + /// Initializes a new instance of . + /// New creation token for the volume that controls the mount point name. + /// Keeps track of any properties unknown to the library. + internal RelocateVolumeRequest(string creationToken, IDictionary additionalBinaryDataProperties) + { + CreationToken = creationToken; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// New creation token for the volume that controls the mount point name. + public string CreationToken { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RemotePath.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RemotePath.Serialization.cs index f1323ee07232..9ecf024ad88f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RemotePath.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RemotePath.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class RemotePath : IUtf8JsonSerializable, IJsonModel + /// The full path to a volume that is to be migrated into ANF. Required for Migration volumes. + public partial class RemotePath : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal RemotePath() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,27 +34,26 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(RemotePath)} does not support writing '{format}' format."); } - writer.WritePropertyName("externalHostName"u8); writer.WriteStringValue(ExternalHostName); writer.WritePropertyName("serverName"u8); writer.WriteStringValue(ServerName); writer.WritePropertyName("volumeName"u8); writer.WriteStringValue(VolumeName); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -57,22 +62,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - RemotePath IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + RemotePath IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual RemotePath JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(RemotePath)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeRemotePath(document.RootElement, options); } - internal static RemotePath DeserializeRemotePath(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RemotePath DeserializeRemotePath(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -80,38 +90,39 @@ internal static RemotePath DeserializeRemotePath(JsonElement element, ModelReade string externalHostName = default; string serverName = default; string volumeName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("externalHostName"u8)) + if (prop.NameEquals("externalHostName"u8)) { - externalHostName = property.Value.GetString(); + externalHostName = prop.Value.GetString(); continue; } - if (property.NameEquals("serverName"u8)) + if (prop.NameEquals("serverName"u8)) { - serverName = property.Value.GetString(); + serverName = prop.Value.GetString(); continue; } - if (property.NameEquals("volumeName"u8)) + if (prop.NameEquals("volumeName"u8)) { - volumeName = property.Value.GetString(); + volumeName = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new RemotePath(externalHostName, serverName, volumeName, serializedAdditionalRawData); + return new RemotePath(externalHostName, serverName, volumeName, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -121,15 +132,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - RemotePath IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + RemotePath IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual RemotePath PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeRemotePath(document.RootElement, options); } default: @@ -137,6 +153,7 @@ RemotePath IPersistableModel.Create(BinaryData data, ModelReaderWrit } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RemotePath.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RemotePath.cs index ef592844bac0..f026080ad8e7 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RemotePath.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/RemotePath.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// The full path to a volume that is to be migrated into ANF. Required for Migration volumes. public partial class RemotePath { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The Path to a ONTAP Host. @@ -65,24 +37,21 @@ public RemotePath(string externalHostName, string serverName, string volumeName) /// The Path to a ONTAP Host. /// The name of a server on the ONTAP Host. /// The name of a volume on the server. - /// Keeps track of any properties unknown to the library. - internal RemotePath(string externalHostName, string serverName, string volumeName, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal RemotePath(string externalHostName, string serverName, string volumeName, IDictionary additionalBinaryDataProperties) { ExternalHostName = externalHostName; ServerName = serverName; VolumeName = volumeName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RemotePath() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The Path to a ONTAP Host. public string ExternalHostName { get; set; } + /// The name of a server on the ONTAP Host. public string ServerName { get; set; } + /// The name of a volume on the server. public string VolumeName { get; set; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Replication.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Replication.Serialization.cs new file mode 100644 index 000000000000..f5debc34950d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Replication.Serialization.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Replication properties. + public partial class Replication : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal Replication() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Replication)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ReplicationId)) + { + writer.WritePropertyName("replicationId"u8); + writer.WriteStringValue(ReplicationId); + } + if (Optional.IsDefined(EndpointType)) + { + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.Value.ToString()); + } + if (Optional.IsDefined(ReplicationSchedule)) + { + writer.WritePropertyName("replicationSchedule"u8); + writer.WriteStringValue(ReplicationSchedule.Value.ToString()); + } + writer.WritePropertyName("remoteVolumeResourceId"u8); + writer.WriteStringValue(RemoteVolumeResourceId); + if (Optional.IsDefined(RemoteVolumeRegion)) + { + writer.WritePropertyName("remoteVolumeRegion"u8); + writer.WriteStringValue(RemoteVolumeRegion); + } + if (options.Format != "W" && Optional.IsDefined(MirrorState)) + { + writer.WritePropertyName("mirrorState"u8); + writer.WriteStringValue(MirrorState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ReplicationCreationOn)) + { + writer.WritePropertyName("replicationCreationTime"u8); + writer.WriteStringValue(ReplicationCreationOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ReplicationDeletionOn)) + { + writer.WritePropertyName("replicationDeletionTime"u8); + writer.WriteStringValue(ReplicationDeletionOn.Value, "O"); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + Replication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual Replication JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Replication)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeReplication(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static Replication DeserializeReplication(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string replicationId = default; + NetAppEndpointType? endpointType = default; + ReplicationSchedule? replicationSchedule = default; + string remoteVolumeResourceId = default; + string remoteVolumeRegion = default; + ReplicationMirrorState? mirrorState = default; + DateTimeOffset? replicationCreationOn = default; + DateTimeOffset? replicationDeletionOn = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("replicationId"u8)) + { + replicationId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("endpointType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endpointType = new NetAppEndpointType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("replicationSchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replicationSchedule = new ReplicationSchedule(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("remoteVolumeResourceId"u8)) + { + remoteVolumeResourceId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("remoteVolumeRegion"u8)) + { + remoteVolumeRegion = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("mirrorState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mirrorState = new ReplicationMirrorState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("replicationCreationTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replicationCreationOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("replicationDeletionTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replicationDeletionOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new Replication( + replicationId, + endpointType, + replicationSchedule, + remoteVolumeResourceId, + remoteVolumeRegion, + mirrorState, + replicationCreationOn, + replicationDeletionOn, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(Replication)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + Replication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual Replication PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeReplication(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Replication)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Replication.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Replication.cs new file mode 100644 index 000000000000..33ecc8b9e465 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Replication.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Replication properties. + public partial class Replication + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The resource ID of the remote volume. + internal Replication(string remoteVolumeResourceId) + { + RemoteVolumeResourceId = remoteVolumeResourceId; + } + + /// Initializes a new instance of . + /// UUID v4 used to identify the replication. + /// Indicates whether the local volume is the source or destination for the Volume Replication. + /// Schedule. + /// The resource ID of the remote volume. + /// The remote region for the other end of the Volume Replication. + /// The status of the replication. + /// Replication creation time. + /// Replication deletion time. + /// Keeps track of any properties unknown to the library. + internal Replication(string replicationId, NetAppEndpointType? endpointType, ReplicationSchedule? replicationSchedule, string remoteVolumeResourceId, string remoteVolumeRegion, ReplicationMirrorState? mirrorState, DateTimeOffset? replicationCreationOn, DateTimeOffset? replicationDeletionOn, IDictionary additionalBinaryDataProperties) + { + ReplicationId = replicationId; + EndpointType = endpointType; + ReplicationSchedule = replicationSchedule; + RemoteVolumeResourceId = remoteVolumeResourceId; + RemoteVolumeRegion = remoteVolumeRegion; + MirrorState = mirrorState; + ReplicationCreationOn = replicationCreationOn; + ReplicationDeletionOn = replicationDeletionOn; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// UUID v4 used to identify the replication. + public string ReplicationId { get; } + + /// Indicates whether the local volume is the source or destination for the Volume Replication. + public NetAppEndpointType? EndpointType { get; } + + /// Schedule. + public ReplicationSchedule? ReplicationSchedule { get; } + + /// The resource ID of the remote volume. + public string RemoteVolumeResourceId { get; } + + /// The remote region for the other end of the Volume Replication. + public string RemoteVolumeRegion { get; } + + /// The status of the replication. + public ReplicationMirrorState? MirrorState { get; } + + /// Replication creation time. + public DateTimeOffset? ReplicationCreationOn { get; } + + /// Replication deletion time. + public DateTimeOffset? ReplicationDeletionOn { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationMirrorState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationMirrorState.cs new file mode 100644 index 000000000000..14db9108ca6b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationMirrorState.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The status of the replication. + public readonly partial struct ReplicationMirrorState : IEquatable + { + private readonly string _value; + /// Destination volume has not been initialized. + private const string UninitializedValue = "Uninitialized"; + /// Destination volume has been initialized and is ready. + private const string MirroredValue = "Mirrored"; + /// Destination volume is RW, replication relationship has been broken off. + private const string BrokenValue = "Broken"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ReplicationMirrorState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Destination volume has not been initialized. + public static ReplicationMirrorState Uninitialized { get; } = new ReplicationMirrorState(UninitializedValue); + + /// Destination volume has been initialized and is ready. + public static ReplicationMirrorState Mirrored { get; } = new ReplicationMirrorState(MirroredValue); + + /// Destination volume is RW, replication relationship has been broken off. + public static ReplicationMirrorState Broken { get; } = new ReplicationMirrorState(BrokenValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ReplicationMirrorState left, ReplicationMirrorState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ReplicationMirrorState left, ReplicationMirrorState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ReplicationMirrorState(string value) => new ReplicationMirrorState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ReplicationMirrorState?(string value) => value == null ? null : new ReplicationMirrorState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReplicationMirrorState other && Equals(other); + + /// + public bool Equals(ReplicationMirrorState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationObject.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationObject.Serialization.cs similarity index 50% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationObject.Serialization.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationObject.Serialization.cs index 9390b1ba8707..06b6f434772f 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationObject.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationObject.Serialization.cs @@ -9,15 +9,16 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class NetAppReplicationObject : IUtf8JsonSerializable, IJsonModel + /// Replication properties. + public partial class ReplicationObject : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(NetAppReplicationObject)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ReplicationObject)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(ReplicationId)) { writer.WritePropertyName("replicationId"u8); @@ -68,7 +68,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("destinationReplications"u8); writer.WriteStartArray(); - foreach (var item in DestinationReplications) + foreach (DestinationReplication item in DestinationReplications) { writer.WriteObjectValue(item, options); } @@ -94,15 +94,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("relationshipStatus"u8); writer.WriteStringValue(RelationshipStatus.Value.ToString()); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -111,183 +111,191 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NetAppReplicationObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ReplicationObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ReplicationObject JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(NetAppReplicationObject)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ReplicationObject)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppReplicationObject(document.RootElement, options); + return DeserializeReplicationObject(document.RootElement, options); } - internal static NetAppReplicationObject DeserializeNetAppReplicationObject(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ReplicationObject DeserializeReplicationObject(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string replicationId = default; NetAppEndpointType? endpointType = default; - NetAppReplicationSchedule? replicationSchedule = default; - ResourceIdentifier remoteVolumeResourceId = default; + ReplicationSchedule? replicationSchedule = default; + string remoteVolumeResourceId = default; RemotePath remotePath = default; string remoteVolumeRegion = default; - IReadOnlyList destinationReplications = default; + IReadOnlyList destinationReplications = default; ExternalReplicationSetupStatus? externalReplicationSetupStatus = default; string externalReplicationSetupInfo = default; NetAppMirrorState? mirrorState = default; - NetAppRelationshipStatus? relationshipStatus = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + VolumeReplicationRelationshipStatus? relationshipStatus = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("replicationId"u8)) + if (prop.NameEquals("replicationId"u8)) { - replicationId = property.Value.GetString(); + replicationId = prop.Value.GetString(); continue; } - if (property.NameEquals("endpointType"u8)) + if (prop.NameEquals("endpointType"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - endpointType = new NetAppEndpointType(property.Value.GetString()); + endpointType = new NetAppEndpointType(prop.Value.GetString()); continue; } - if (property.NameEquals("replicationSchedule"u8)) + if (prop.NameEquals("replicationSchedule"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - replicationSchedule = new NetAppReplicationSchedule(property.Value.GetString()); + replicationSchedule = new ReplicationSchedule(prop.Value.GetString()); continue; } - if (property.NameEquals("remoteVolumeResourceId"u8)) + if (prop.NameEquals("remoteVolumeResourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - remoteVolumeResourceId = new ResourceIdentifier(property.Value.GetString()); + remoteVolumeResourceId = prop.Value.GetString(); continue; } - if (property.NameEquals("remotePath"u8)) + if (prop.NameEquals("remotePath"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - remotePath = RemotePath.DeserializeRemotePath(property.Value, options); + remotePath = RemotePath.DeserializeRemotePath(prop.Value, options); continue; } - if (property.NameEquals("remoteVolumeRegion"u8)) + if (prop.NameEquals("remoteVolumeRegion"u8)) { - remoteVolumeRegion = property.Value.GetString(); + remoteVolumeRegion = prop.Value.GetString(); continue; } - if (property.NameEquals("destinationReplications"u8)) + if (prop.NameEquals("destinationReplications"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(NetAppDestinationReplication.DeserializeNetAppDestinationReplication(item, options)); + array.Add(DestinationReplication.DeserializeDestinationReplication(item, options)); } destinationReplications = array; continue; } - if (property.NameEquals("externalReplicationSetupStatus"u8)) + if (prop.NameEquals("externalReplicationSetupStatus"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - externalReplicationSetupStatus = new ExternalReplicationSetupStatus(property.Value.GetString()); + externalReplicationSetupStatus = new ExternalReplicationSetupStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("externalReplicationSetupInfo"u8)) + if (prop.NameEquals("externalReplicationSetupInfo"u8)) { - externalReplicationSetupInfo = property.Value.GetString(); + externalReplicationSetupInfo = prop.Value.GetString(); continue; } - if (property.NameEquals("mirrorState"u8)) + if (prop.NameEquals("mirrorState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - mirrorState = new NetAppMirrorState(property.Value.GetString()); + mirrorState = new NetAppMirrorState(prop.Value.GetString()); continue; } - if (property.NameEquals("relationshipStatus"u8)) + if (prop.NameEquals("relationshipStatus"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - relationshipStatus = new NetAppRelationshipStatus(property.Value.GetString()); + relationshipStatus = new VolumeReplicationRelationshipStatus(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppReplicationObject( + return new ReplicationObject( replicationId, endpointType, replicationSchedule, remoteVolumeResourceId, remotePath, remoteVolumeRegion, - destinationReplications ?? new ChangeTrackingList(), + destinationReplications ?? new ChangeTrackingList(), externalReplicationSetupStatus, externalReplicationSetupInfo, mirrorState, relationshipStatus, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); default: - throw new FormatException($"The model {nameof(NetAppReplicationObject)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ReplicationObject)} does not support writing '{options.Format}' format."); } } - NetAppReplicationObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ReplicationObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ReplicationObject PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppReplicationObject(document.RootElement, options); + return DeserializeReplicationObject(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(NetAppReplicationObject)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ReplicationObject)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationObject.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationObject.cs similarity index 57% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationObject.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationObject.cs index 4186a6039744..98b5f94b2027 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppReplicationObject.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationObject.cs @@ -7,52 +7,23 @@ using System; using System.Collections.Generic; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Replication properties. - public partial class NetAppReplicationObject + public partial class ReplicationObject { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppReplicationObject() + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ReplicationObject() { - DestinationReplications = new ChangeTrackingList(); + DestinationReplications = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Id. /// Indicates whether the local volume is the source or destination for the Volume Replication. /// Schedule. @@ -64,8 +35,8 @@ public NetAppReplicationObject() /// Contains human-readable instructions on what the next step is to finish the external replication setup. /// The mirror state property describes the current status of data replication for a replication. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. /// The status of the Volume Replication. - /// Keeps track of any properties unknown to the library. - internal NetAppReplicationObject(string replicationId, NetAppEndpointType? endpointType, NetAppReplicationSchedule? replicationSchedule, ResourceIdentifier remoteVolumeResourceId, RemotePath remotePath, string remoteVolumeRegion, IReadOnlyList destinationReplications, ExternalReplicationSetupStatus? externalReplicationSetupStatus, string externalReplicationSetupInfo, NetAppMirrorState? mirrorState, NetAppRelationshipStatus? relationshipStatus, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ReplicationObject(string replicationId, NetAppEndpointType? endpointType, ReplicationSchedule? replicationSchedule, string remoteVolumeResourceId, RemotePath remotePath, string remoteVolumeRegion, IReadOnlyList destinationReplications, ExternalReplicationSetupStatus? externalReplicationSetupStatus, string externalReplicationSetupInfo, NetAppMirrorState? mirrorState, VolumeReplicationRelationshipStatus? relationshipStatus, IDictionary additionalBinaryDataProperties) { ReplicationId = replicationId; EndpointType = endpointType; @@ -78,25 +49,40 @@ internal NetAppReplicationObject(string replicationId, NetAppEndpointType? endpo ExternalReplicationSetupInfo = externalReplicationSetupInfo; MirrorState = mirrorState; RelationshipStatus = relationshipStatus; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } + + /// Id. + public string ReplicationId { get; } + + /// Indicates whether the local volume is the source or destination for the Volume Replication. + public NetAppEndpointType? EndpointType { get; } + /// Schedule. - public NetAppReplicationSchedule? ReplicationSchedule { get; set; } + public ReplicationSchedule? ReplicationSchedule { get; set; } + /// The resource ID of the remote volume. Required for cross region and cross zone replication. - public ResourceIdentifier RemoteVolumeResourceId { get; set; } + public string RemoteVolumeResourceId { get; set; } + /// The full path to a volume that is to be migrated into ANF. Required for Migration volumes. public RemotePath RemotePath { get; set; } + /// The remote region for the other end of the Volume Replication. public string RemoteVolumeRegion { get; set; } + /// A list of destination replications. - public IReadOnlyList DestinationReplications { get; } + public IReadOnlyList DestinationReplications { get; } + /// Property that only applies to external replications. Provides a machine-readable value for the status of the external replication setup. public ExternalReplicationSetupStatus? ExternalReplicationSetupStatus { get; } + /// Contains human-readable instructions on what the next step is to finish the external replication setup. public string ExternalReplicationSetupInfo { get; } + /// The mirror state property describes the current status of data replication for a replication. It provides insight into whether the data is actively being mirrored, if the replication process has been paused, or if it has yet to be initialized. public NetAppMirrorState? MirrorState { get; } + /// The status of the Volume Replication. - public NetAppRelationshipStatus? RelationshipStatus { get; } + public VolumeReplicationRelationshipStatus? RelationshipStatus { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationSchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationSchedule.cs new file mode 100644 index 000000000000..da8478cce449 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationSchedule.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Schedule. + public readonly partial struct ReplicationSchedule : IEquatable + { + private readonly string _value; + private const string TenMinutelyValue = "_10minutely"; + private const string HourlyValue = "hourly"; + private const string DailyValue = "daily"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ReplicationSchedule(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the TenMinutely. + public static ReplicationSchedule TenMinutely { get; } = new ReplicationSchedule(TenMinutelyValue); + + /// Gets the Hourly. + public static ReplicationSchedule Hourly { get; } = new ReplicationSchedule(HourlyValue); + + /// Gets the Daily. + public static ReplicationSchedule Daily { get; } = new ReplicationSchedule(DailyValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ReplicationSchedule left, ReplicationSchedule right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ReplicationSchedule left, ReplicationSchedule right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ReplicationSchedule(string value) => new ReplicationSchedule(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ReplicationSchedule?(string value) => value == null ? null : new ReplicationSchedule(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReplicationSchedule other && Equals(other); + + /// + public bool Equals(ReplicationSchedule other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationStatus.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationStatus.Serialization.cs new file mode 100644 index 000000000000..cc729139273d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationStatus.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Replication status. + public partial class ReplicationStatus : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ReplicationStatus)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Healthy)) + { + writer.WritePropertyName("healthy"u8); + writer.WriteBooleanValue(Healthy.Value); + } + if (Optional.IsDefined(RelationshipStatus)) + { + writer.WritePropertyName("relationshipStatus"u8); + writer.WriteStringValue(RelationshipStatus.Value.ToString()); + } + if (Optional.IsDefined(MirrorState)) + { + writer.WritePropertyName("mirrorState"u8); + writer.WriteStringValue(MirrorState.Value.ToString()); + } + if (Optional.IsDefined(TotalProgress)) + { + writer.WritePropertyName("totalProgress"u8); + writer.WriteStringValue(TotalProgress); + } + if (Optional.IsDefined(ErrorMessage)) + { + writer.WritePropertyName("errorMessage"u8); + writer.WriteStringValue(ErrorMessage); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ReplicationStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ReplicationStatus JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ReplicationStatus)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeReplicationStatus(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ReplicationStatus DeserializeReplicationStatus(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? healthy = default; + VolumeReplicationRelationshipStatus? relationshipStatus = default; + NetAppMirrorState? mirrorState = default; + string totalProgress = default; + string errorMessage = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("healthy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + healthy = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("relationshipStatus"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + relationshipStatus = new VolumeReplicationRelationshipStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("mirrorState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mirrorState = new NetAppMirrorState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("totalProgress"u8)) + { + totalProgress = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("errorMessage"u8)) + { + errorMessage = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ReplicationStatus( + healthy, + relationshipStatus, + mirrorState, + totalProgress, + errorMessage, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ReplicationStatus)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ReplicationStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ReplicationStatus PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeReplicationStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ReplicationStatus)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ReplicationStatus FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeReplicationStatus(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationStatus.cs new file mode 100644 index 000000000000..614c01ab59a3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationStatus.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Replication status. + public partial class ReplicationStatus + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ReplicationStatus() + { + } + + /// Initializes a new instance of . + /// Replication health check. + /// Status of the mirror relationship. + /// The status of the replication. + /// The progress of the replication. + /// Displays error message if the replication is in an error state. + /// Keeps track of any properties unknown to the library. + internal ReplicationStatus(bool? healthy, VolumeReplicationRelationshipStatus? relationshipStatus, NetAppMirrorState? mirrorState, string totalProgress, string errorMessage, IDictionary additionalBinaryDataProperties) + { + Healthy = healthy; + RelationshipStatus = relationshipStatus; + MirrorState = mirrorState; + TotalProgress = totalProgress; + ErrorMessage = errorMessage; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Replication health check. + public bool? Healthy { get; } + + /// Status of the mirror relationship. + public VolumeReplicationRelationshipStatus? RelationshipStatus { get; } + + /// The status of the replication. + public NetAppMirrorState? MirrorState { get; } + + /// The progress of the replication. + public string TotalProgress { get; } + + /// Displays error message if the replication is in an error state. + public string ErrorMessage { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationType.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationType.cs new file mode 100644 index 000000000000..8b50804c4b98 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ReplicationType.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Indicates whether the replication is cross zone or cross region. + public readonly partial struct ReplicationType : IEquatable + { + private readonly string _value; + /// Cross region replication. + private const string CrossRegionReplicationValue = "CrossRegionReplication"; + /// Cross zone replication. + private const string CrossZoneReplicationValue = "CrossZoneReplication"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ReplicationType(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Cross region replication. + public static ReplicationType CrossRegionReplication { get; } = new ReplicationType(CrossRegionReplicationValue); + + /// Cross zone replication. + public static ReplicationType CrossZoneReplication { get; } = new ReplicationType(CrossZoneReplicationValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ReplicationType left, ReplicationType right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ReplicationType left, ReplicationType right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ReplicationType(string value) => new ReplicationType(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ReplicationType?(string value) => value == null ? null : new ReplicationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReplicationType other && Equals(other); + + /// + public bool Equals(ReplicationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ResourceNameAvailabilityRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ResourceNameAvailabilityRequest.Serialization.cs new file mode 100644 index 000000000000..9c1502533a32 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ResourceNameAvailabilityRequest.Serialization.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Resource name availability request content. + public partial class ResourceNameAvailabilityRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ResourceNameAvailabilityRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceNameAvailabilityRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + writer.WritePropertyName("resourceGroup"u8); + writer.WriteStringValue(ResourceGroup); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ResourceNameAvailabilityRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceNameAvailabilityRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceNameAvailabilityRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceNameAvailabilityRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ResourceNameAvailabilityRequest DeserializeResourceNameAvailabilityRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + CheckNameResourceTypes @type = default; + string resourceGroup = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + @type = new CheckNameResourceTypes(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("resourceGroup"u8)) + { + resourceGroup = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ResourceNameAvailabilityRequest(name, @type, resourceGroup, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceNameAvailabilityRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ResourceNameAvailabilityRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceNameAvailabilityRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeResourceNameAvailabilityRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceNameAvailabilityRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ResourceNameAvailabilityRequest resourceNameAvailabilityRequest) + { + if (resourceNameAvailabilityRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(resourceNameAvailabilityRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ResourceNameAvailabilityRequest.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ResourceNameAvailabilityRequest.cs new file mode 100644 index 000000000000..51b4b508af00 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ResourceNameAvailabilityRequest.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Resource name availability request content. + public partial class ResourceNameAvailabilityRequest + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Resource name to verify. + /// Resource type used for verification. + /// Resource group name. + /// or is null. + public ResourceNameAvailabilityRequest(string name, CheckNameResourceTypes @type, string resourceGroup) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(resourceGroup, nameof(resourceGroup)); + + Name = name; + Type = @type; + ResourceGroup = resourceGroup; + } + + /// Initializes a new instance of . + /// Resource name to verify. + /// Resource type used for verification. + /// Resource group name. + /// Keeps track of any properties unknown to the library. + internal ResourceNameAvailabilityRequest(string name, CheckNameResourceTypes @type, string resourceGroup, IDictionary additionalBinaryDataProperties) + { + Name = name; + Type = @type; + ResourceGroup = resourceGroup; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource name to verify. + public string Name { get; } + + /// Resource type used for verification. + public CheckNameResourceTypes Type { get; } + + /// Resource group name. + public string ResourceGroup { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPassword.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPassword.Serialization.cs new file mode 100644 index 000000000000..b9dd58b3fe83 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPassword.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Access password from Azure KeyVault Secrets to connect Active Directory. + public partial class SecretPassword : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecretPassword)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(KeyVaultProperties)) + { + writer.WritePropertyName("keyVaultProperties"u8); + writer.WriteObjectValue(KeyVaultProperties, options); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SecretPassword IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecretPassword JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecretPassword)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretPassword(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretPassword DeserializeSecretPassword(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SecretPasswordKeyVaultProperties keyVaultProperties = default; + SecretPasswordIdentity identity = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("keyVaultProperties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultProperties = SecretPasswordKeyVaultProperties.DeserializeSecretPasswordKeyVaultProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("identity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = SecretPasswordIdentity.DeserializeSecretPasswordIdentity(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SecretPassword(keyVaultProperties, identity, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SecretPassword)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SecretPassword IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecretPassword PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSecretPassword(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretPassword)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPassword.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPassword.cs new file mode 100644 index 000000000000..0a5ab1d81a6b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPassword.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Access password from Azure KeyVault Secrets to connect Active Directory. + public partial class SecretPassword + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SecretPassword() + { + } + + /// Initializes a new instance of . + /// Properties provided by KeyVault. + /// Identity used to authenticate to KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. + /// Keeps track of any properties unknown to the library. + internal SecretPassword(SecretPasswordKeyVaultProperties keyVaultProperties, SecretPasswordIdentity identity, IDictionary additionalBinaryDataProperties) + { + KeyVaultProperties = keyVaultProperties; + Identity = identity; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Properties provided by KeyVault. + public SecretPasswordKeyVaultProperties KeyVaultProperties { get; set; } + + /// Identity used to authenticate to KeyVault. Applicable if keySource is 'Microsoft.KeyVault'. + public SecretPasswordIdentity Identity { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordIdentity.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordIdentity.Serialization.cs new file mode 100644 index 000000000000..e62da9c83f49 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordIdentity.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Identity used to authenticate with key vault. + public partial class SecretPasswordIdentity : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecretPasswordIdentity)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId); + } + if (Optional.IsDefined(UserAssignedIdentity)) + { + writer.WritePropertyName("userAssignedIdentity"u8); + writer.WriteStringValue(UserAssignedIdentity); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SecretPasswordIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecretPasswordIdentity JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecretPasswordIdentity)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretPasswordIdentity(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretPasswordIdentity DeserializeSecretPasswordIdentity(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string principalId = default; + string userAssignedIdentity = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("principalId"u8)) + { + principalId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("userAssignedIdentity"u8)) + { + userAssignedIdentity = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SecretPasswordIdentity(principalId, userAssignedIdentity, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SecretPasswordIdentity)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SecretPasswordIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecretPasswordIdentity PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSecretPasswordIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretPasswordIdentity)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordIdentity.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordIdentity.cs new file mode 100644 index 000000000000..edac8d45b9cc --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordIdentity.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Identity used to authenticate with key vault. + public partial class SecretPasswordIdentity + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SecretPasswordIdentity() + { + } + + /// Initializes a new instance of . + /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. + /// The Azure resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. + /// Keeps track of any properties unknown to the library. + internal SecretPasswordIdentity(string principalId, string userAssignedIdentity, IDictionary additionalBinaryDataProperties) + { + PrincipalId = principalId; + UserAssignedIdentity = userAssignedIdentity; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The principal ID (object ID) of the identity used to authenticate with key vault. Read-only. + public string PrincipalId { get; } + + /// The Azure resource identifier of the user assigned identity used to authenticate with key vault. Applicable if identity.type has 'UserAssigned'. It should match key of identity.userAssignedIdentities. + public string UserAssignedIdentity { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordKeyVaultProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordKeyVaultProperties.Serialization.cs new file mode 100644 index 000000000000..795c6141b1d4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordKeyVaultProperties.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of key vault to get the secrets for password. + public partial class SecretPasswordKeyVaultProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal SecretPasswordKeyVaultProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecretPasswordKeyVaultProperties)} does not support writing '{format}' format."); + } + writer.WritePropertyName("keyVaultUri"u8); + writer.WriteStringValue(KeyVaultUri.AbsoluteUri); + writer.WritePropertyName("secretName"u8); + writer.WriteStringValue(SecretName); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SecretPasswordKeyVaultProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecretPasswordKeyVaultProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecretPasswordKeyVaultProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretPasswordKeyVaultProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretPasswordKeyVaultProperties DeserializeSecretPasswordKeyVaultProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri keyVaultUri = default; + string secretName = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("keyVaultUri"u8)) + { + keyVaultUri = new Uri(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("secretName"u8)) + { + secretName = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SecretPasswordKeyVaultProperties(keyVaultUri, secretName, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SecretPasswordKeyVaultProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SecretPasswordKeyVaultProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecretPasswordKeyVaultProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSecretPasswordKeyVaultProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretPasswordKeyVaultProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordKeyVaultProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordKeyVaultProperties.cs new file mode 100644 index 000000000000..a2763671c778 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecretPasswordKeyVaultProperties.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties of key vault to get the secrets for password. + public partial class SecretPasswordKeyVaultProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The Uri of KeyVault. + /// The name of KeyVault password secret. + /// or is null. + public SecretPasswordKeyVaultProperties(Uri keyVaultUri, string secretName) + { + Argument.AssertNotNull(keyVaultUri, nameof(keyVaultUri)); + Argument.AssertNotNull(secretName, nameof(secretName)); + + KeyVaultUri = keyVaultUri; + SecretName = secretName; + } + + /// Initializes a new instance of . + /// The Uri of KeyVault. + /// The name of KeyVault password secret. + /// Keeps track of any properties unknown to the library. + internal SecretPasswordKeyVaultProperties(Uri keyVaultUri, string secretName, IDictionary additionalBinaryDataProperties) + { + KeyVaultUri = keyVaultUri; + SecretName = secretName; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The Uri of KeyVault. + public Uri KeyVaultUri { get; set; } + + /// The name of KeyVault password secret. + public string SecretName { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecurityStyle.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecurityStyle.cs new file mode 100644 index 000000000000..99bb9a9f5996 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SecurityStyle.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. + public readonly partial struct SecurityStyle : IEquatable + { + private readonly string _value; + private const string NtfsValue = "ntfs"; + private const string UnixValue = "unix"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public SecurityStyle(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Ntfs. + public static SecurityStyle Ntfs { get; } = new SecurityStyle(NtfsValue); + + /// Gets the Unix. + public static SecurityStyle Unix { get; } = new SecurityStyle(UnixValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(SecurityStyle left, SecurityStyle right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(SecurityStyle left, SecurityStyle right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator SecurityStyle(string value) => new SecurityStyle(value); + + /// Converts a string to a . + /// The value. + public static implicit operator SecurityStyle?(string value) => value == null ? null : new SecurityStyle(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SecurityStyle other && Equals(other); + + /// + public bool Equals(SecurityStyle other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ServiceSpecification.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ServiceSpecification.Serialization.cs new file mode 100644 index 000000000000..2e6b4e7cd54d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ServiceSpecification.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// One property of operation, include metric specifications. + public partial class ServiceSpecification : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ServiceSpecification)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(MetricSpecifications)) + { + writer.WritePropertyName("metricSpecifications"u8); + writer.WriteStartArray(); + foreach (MetricSpecification item in MetricSpecifications) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(LogSpecifications)) + { + writer.WritePropertyName("logSpecifications"u8); + writer.WriteStartArray(); + foreach (LogSpecification item in LogSpecifications) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ServiceSpecification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ServiceSpecification JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ServiceSpecification)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeServiceSpecification(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ServiceSpecification DeserializeServiceSpecification(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList metricSpecifications = default; + IList logSpecifications = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("metricSpecifications"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(MetricSpecification.DeserializeMetricSpecification(item, options)); + } + metricSpecifications = array; + continue; + } + if (prop.NameEquals("logSpecifications"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(LogSpecification.DeserializeLogSpecification(item, options)); + } + logSpecifications = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ServiceSpecification(metricSpecifications ?? new ChangeTrackingList(), logSpecifications ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(ServiceSpecification)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ServiceSpecification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ServiceSpecification PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeServiceSpecification(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ServiceSpecification)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ServiceSpecification.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ServiceSpecification.cs new file mode 100644 index 000000000000..d62dbaef247a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/ServiceSpecification.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// One property of operation, include metric specifications. + public partial class ServiceSpecification + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ServiceSpecification() + { + MetricSpecifications = new ChangeTrackingList(); + LogSpecifications = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Metric specifications of operation. + /// Log specification of operation. + /// Keeps track of any properties unknown to the library. + internal ServiceSpecification(IList metricSpecifications, IList logSpecifications, IDictionary additionalBinaryDataProperties) + { + MetricSpecifications = metricSpecifications; + LogSpecifications = logSpecifications; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Metric specifications of operation. + public IList MetricSpecifications { get; } + + /// Log specification of operation. + public IList LogSpecifications { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbAccessBasedEnumeration.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbAccessBasedEnumeration.cs index 2563fc271682..fbd3e53a9be3 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbAccessBasedEnumeration.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbAccessBasedEnumeration.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct SmbAccessBasedEnumeration : IEquatable { private readonly string _value; + /// smbAccessBasedEnumeration share setting is disabled. + private const string DisabledValue = "Disabled"; + /// smbAccessBasedEnumeration share setting is enabled. + private const string EnabledValue = "Enabled"; /// Initializes a new instance of . + /// The value. /// is null. public SmbAccessBasedEnumeration(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string DisabledValue = "Disabled"; - private const string EnabledValue = "Enabled"; + _value = value; + } /// smbAccessBasedEnumeration share setting is disabled. public static SmbAccessBasedEnumeration Disabled { get; } = new SmbAccessBasedEnumeration(DisabledValue); + /// smbAccessBasedEnumeration share setting is enabled. public static SmbAccessBasedEnumeration Enabled { get; } = new SmbAccessBasedEnumeration(EnabledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(SmbAccessBasedEnumeration left, SmbAccessBasedEnumeration right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(SmbAccessBasedEnumeration left, SmbAccessBasedEnumeration right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator SmbAccessBasedEnumeration(string value) => new SmbAccessBasedEnumeration(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator SmbAccessBasedEnumeration?(string value) => value == null ? null : new SmbAccessBasedEnumeration(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is SmbAccessBasedEnumeration other && Equals(other); - /// + + /// public bool Equals(SmbAccessBasedEnumeration other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbEncryptionState.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbEncryptionState.cs new file mode 100644 index 000000000000..4e57e802bb68 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbEncryptionState.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol cache. + public readonly partial struct SmbEncryptionState : IEquatable + { + private readonly string _value; + /// SMB encryption is disabled. + private const string DisabledValue = "Disabled"; + /// SMB encryption is enabled. + private const string EnabledValue = "Enabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public SmbEncryptionState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// SMB encryption is disabled. + public static SmbEncryptionState Disabled { get; } = new SmbEncryptionState(DisabledValue); + + /// SMB encryption is enabled. + public static SmbEncryptionState Enabled { get; } = new SmbEncryptionState(EnabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(SmbEncryptionState left, SmbEncryptionState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(SmbEncryptionState left, SmbEncryptionState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator SmbEncryptionState(string value) => new SmbEncryptionState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator SmbEncryptionState?(string value) => value == null ? null : new SmbEncryptionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SmbEncryptionState other && Equals(other); + + /// + public bool Equals(SmbEncryptionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbNonBrowsable.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbNonBrowsable.cs index 5e0a4c07f636..122cdf574200 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbNonBrowsable.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbNonBrowsable.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.NetApp.Models public readonly partial struct SmbNonBrowsable : IEquatable { private readonly string _value; + /// smbNonBrowsable share setting is disabled. + private const string DisabledValue = "Disabled"; + /// smbNonBrowsable share setting is enabled. + private const string EnabledValue = "Enabled"; /// Initializes a new instance of . + /// The value. /// is null. public SmbNonBrowsable(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string DisabledValue = "Disabled"; - private const string EnabledValue = "Enabled"; + _value = value; + } /// smbNonBrowsable share setting is disabled. public static SmbNonBrowsable Disabled { get; } = new SmbNonBrowsable(DisabledValue); + /// smbNonBrowsable share setting is enabled. public static SmbNonBrowsable Enabled { get; } = new SmbNonBrowsable(EnabledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(SmbNonBrowsable left, SmbNonBrowsable right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(SmbNonBrowsable left, SmbNonBrowsable right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator SmbNonBrowsable(string value) => new SmbNonBrowsable(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator SmbNonBrowsable?(string value) => value == null ? null : new SmbNonBrowsable(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is SmbNonBrowsable other && Equals(other); - /// + + /// public bool Equals(SmbNonBrowsable other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbSettings.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbSettings.Serialization.cs new file mode 100644 index 000000000000..e7b0ce64f7b3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbSettings.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// SMB settings for the cache. + public partial class SmbSettings : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SmbSettings)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SmbEncryption)) + { + writer.WritePropertyName("smbEncryption"u8); + writer.WriteStringValue(SmbEncryption.Value.ToString()); + } + if (Optional.IsDefined(SmbAccessBasedEnumerations)) + { + writer.WritePropertyName("smbAccessBasedEnumerations"u8); + writer.WriteStringValue(SmbAccessBasedEnumerations.Value.ToString()); + } + if (Optional.IsDefined(SmbNonBrowsable)) + { + writer.WritePropertyName("smbNonBrowsable"u8); + writer.WriteStringValue(SmbNonBrowsable.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SmbSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SmbSettings JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SmbSettings)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSmbSettings(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SmbSettings DeserializeSmbSettings(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SmbEncryptionState? smbEncryption = default; + SmbAccessBasedEnumeration? smbAccessBasedEnumerations = default; + SmbNonBrowsable? smbNonBrowsable = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("smbEncryption"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbEncryption = new SmbEncryptionState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbAccessBasedEnumerations"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbAccessBasedEnumerations = new SmbAccessBasedEnumeration(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbNonBrowsable"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbNonBrowsable = new SmbNonBrowsable(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SmbSettings(smbEncryption, smbAccessBasedEnumerations, smbNonBrowsable, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SmbSettings)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SmbSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SmbSettings PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSmbSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SmbSettings)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbSettings.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbSettings.cs new file mode 100644 index 000000000000..5d08b30cc8cf --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SmbSettings.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// SMB settings for the cache. + public partial class SmbSettings + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SmbSettings() + { + } + + /// Initializes a new instance of . + /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol cache. + /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. + /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. + /// Keeps track of any properties unknown to the library. + internal SmbSettings(SmbEncryptionState? smbEncryption, SmbAccessBasedEnumeration? smbAccessBasedEnumerations, SmbNonBrowsable? smbNonBrowsable, IDictionary additionalBinaryDataProperties) + { + SmbEncryption = smbEncryption; + SmbAccessBasedEnumerations = smbAccessBasedEnumerations; + SmbNonBrowsable = smbNonBrowsable; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol cache. + public SmbEncryptionState? SmbEncryption { get; set; } + + /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. + public SmbAccessBasedEnumeration? SmbAccessBasedEnumerations { get; set; } + + /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. + public SmbNonBrowsable? SmbNonBrowsable { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotDirectoryVisibility.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotDirectoryVisibility.cs new file mode 100644 index 000000000000..4ee6358f737f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotDirectoryVisibility.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Controls the visibility of the volume's read-only snapshot directory, which provides access to each of the volume's snapshots. + public readonly partial struct SnapshotDirectoryVisibility : IEquatable + { + private readonly string _value; + /// Value indicating the read-only snapshot directory is not visible. + private const string HiddenValue = "Hidden"; + /// Value indicating the read-only snapshot directory is visible. + private const string VisibleValue = "Visible"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public SnapshotDirectoryVisibility(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Value indicating the read-only snapshot directory is not visible. + public static SnapshotDirectoryVisibility Hidden { get; } = new SnapshotDirectoryVisibility(HiddenValue); + + /// Value indicating the read-only snapshot directory is visible. + public static SnapshotDirectoryVisibility Visible { get; } = new SnapshotDirectoryVisibility(VisibleValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(SnapshotDirectoryVisibility left, SnapshotDirectoryVisibility right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(SnapshotDirectoryVisibility left, SnapshotDirectoryVisibility right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator SnapshotDirectoryVisibility(string value) => new SnapshotDirectoryVisibility(value); + + /// Converts a string to a . + /// The value. + public static implicit operator SnapshotDirectoryVisibility?(string value) => value == null ? null : new SnapshotDirectoryVisibility(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SnapshotDirectoryVisibility other && Equals(other); + + /// + public bool Equals(SnapshotDirectoryVisibility other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPatch.Serialization.cs new file mode 100644 index 000000000000..a177b8339a40 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPatch.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Snapshot of a Volume. + public partial class SnapshotPatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SnapshotPatch)} does not support writing '{format}' format."); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SnapshotPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SnapshotPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SnapshotPatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotPatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SnapshotPatch DeserializeSnapshotPatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SnapshotPatch(additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SnapshotPatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SnapshotPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SnapshotPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSnapshotPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SnapshotPatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(SnapshotPatch snapshotPatch) + { + if (snapshotPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(snapshotPatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPatch.cs new file mode 100644 index 000000000000..98825e30ccfc --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPatch.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Snapshot of a Volume. + public partial class SnapshotPatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SnapshotPatch() + { + } + + /// Initializes a new instance of . + /// Keeps track of any properties unknown to the library. + internal SnapshotPatch(IDictionary additionalBinaryDataProperties) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPoliciesList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPoliciesList.Serialization.cs index c0bb7b2835f2..e41e054e01d0 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPoliciesList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPoliciesList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class SnapshotPoliciesList : IUtf8JsonSerializable, IJsonModel + /// List of Snapshot Policies. + internal partial class SnapshotPoliciesList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal SnapshotPoliciesList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SnapshotPoliciesList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (SnapshotPolicyData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SnapshotPoliciesList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SnapshotPoliciesList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SnapshotPoliciesList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SnapshotPoliciesList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSnapshotPoliciesList(document.RootElement, options); } - internal static SnapshotPoliciesList DeserializeSnapshotPoliciesList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SnapshotPoliciesList DeserializeSnapshotPoliciesList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(SnapshotPolicyData.DeserializeSnapshotPolicyData(item, options)); } value = array; continue; } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); + continue; + } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new SnapshotPoliciesList(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new SnapshotPoliciesList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption } } - SnapshotPoliciesList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + SnapshotPoliciesList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SnapshotPoliciesList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeSnapshotPoliciesList(document.RootElement, options); } default: @@ -138,6 +163,15 @@ SnapshotPoliciesList IPersistableModel.Create(BinaryData d } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static SnapshotPoliciesList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSnapshotPoliciesList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPoliciesList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPoliciesList.cs index 4dfe195b90b1..01019845e1b4 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPoliciesList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPoliciesList.cs @@ -7,60 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of Snapshot Policies. internal partial class SnapshotPoliciesList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal SnapshotPoliciesList() + /// The SnapshotPolicy items on this page. + internal SnapshotPoliciesList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// A list of snapshot policies. - /// Keeps track of any properties unknown to the library. - internal SnapshotPoliciesList(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// The SnapshotPolicy items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SnapshotPoliciesList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// A list of snapshot policies. - public IReadOnlyList Value { get; } + /// The SnapshotPolicy items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyDailySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyDailySchedule.Serialization.cs deleted file mode 100644 index 77887aafa864..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyDailySchedule.Serialization.cs +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class SnapshotPolicyDailySchedule : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SnapshotPolicyDailySchedule)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SnapshotsToKeep)) - { - writer.WritePropertyName("snapshotsToKeep"u8); - writer.WriteNumberValue(SnapshotsToKeep.Value); - } - if (Optional.IsDefined(Hour)) - { - writer.WritePropertyName("hour"u8); - writer.WriteNumberValue(Hour.Value); - } - if (Optional.IsDefined(Minute)) - { - writer.WritePropertyName("minute"u8); - writer.WriteNumberValue(Minute.Value); - } - if (Optional.IsDefined(UsedBytes)) - { - writer.WritePropertyName("usedBytes"u8); - writer.WriteNumberValue(UsedBytes.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SnapshotPolicyDailySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SnapshotPolicyDailySchedule)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSnapshotPolicyDailySchedule(document.RootElement, options); - } - - internal static SnapshotPolicyDailySchedule DeserializeSnapshotPolicyDailySchedule(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? snapshotsToKeep = default; - int? hour = default; - int? minute = default; - long? usedBytes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("snapshotsToKeep"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - snapshotsToKeep = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("hour"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hour = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("minute"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minute = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("usedBytes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - usedBytes = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SnapshotPolicyDailySchedule(snapshotsToKeep, hour, minute, usedBytes, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(SnapshotPolicyDailySchedule)} does not support writing '{options.Format}' format."); - } - } - - SnapshotPolicyDailySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSnapshotPolicyDailySchedule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SnapshotPolicyDailySchedule)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyDailySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyDailySchedule.cs deleted file mode 100644 index e8a39dd29bf0..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyDailySchedule.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Daily Schedule properties. - public partial class SnapshotPolicyDailySchedule - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public SnapshotPolicyDailySchedule() - { - } - - /// Initializes a new instance of . - /// Daily snapshot count to keep. - /// Indicates which hour in UTC timezone a snapshot should be taken. - /// Indicates which minute snapshot should be taken. - /// Resource size in bytes, current storage usage for the volume in bytes. - /// Keeps track of any properties unknown to the library. - internal SnapshotPolicyDailySchedule(int? snapshotsToKeep, int? hour, int? minute, long? usedBytes, IDictionary serializedAdditionalRawData) - { - SnapshotsToKeep = snapshotsToKeep; - Hour = hour; - Minute = minute; - UsedBytes = usedBytes; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Daily snapshot count to keep. - public int? SnapshotsToKeep { get; set; } - /// Indicates which hour in UTC timezone a snapshot should be taken. - public int? Hour { get; set; } - /// Indicates which minute snapshot should be taken. - public int? Minute { get; set; } - /// Resource size in bytes, current storage usage for the volume in bytes. - public long? UsedBytes { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyHourlySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyHourlySchedule.Serialization.cs deleted file mode 100644 index f29ddd62e94f..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyHourlySchedule.Serialization.cs +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class SnapshotPolicyHourlySchedule : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SnapshotPolicyHourlySchedule)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SnapshotsToKeep)) - { - writer.WritePropertyName("snapshotsToKeep"u8); - writer.WriteNumberValue(SnapshotsToKeep.Value); - } - if (Optional.IsDefined(Minute)) - { - writer.WritePropertyName("minute"u8); - writer.WriteNumberValue(Minute.Value); - } - if (Optional.IsDefined(UsedBytes)) - { - writer.WritePropertyName("usedBytes"u8); - writer.WriteNumberValue(UsedBytes.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SnapshotPolicyHourlySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SnapshotPolicyHourlySchedule)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSnapshotPolicyHourlySchedule(document.RootElement, options); - } - - internal static SnapshotPolicyHourlySchedule DeserializeSnapshotPolicyHourlySchedule(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? snapshotsToKeep = default; - int? minute = default; - long? usedBytes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("snapshotsToKeep"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - snapshotsToKeep = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("minute"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minute = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("usedBytes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - usedBytes = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SnapshotPolicyHourlySchedule(snapshotsToKeep, minute, usedBytes, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(SnapshotPolicyHourlySchedule)} does not support writing '{options.Format}' format."); - } - } - - SnapshotPolicyHourlySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSnapshotPolicyHourlySchedule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SnapshotPolicyHourlySchedule)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyHourlySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyHourlySchedule.cs deleted file mode 100644 index 04a11d98b729..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyHourlySchedule.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Hourly Schedule properties. - public partial class SnapshotPolicyHourlySchedule - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public SnapshotPolicyHourlySchedule() - { - } - - /// Initializes a new instance of . - /// Hourly snapshot count to keep. - /// Indicates which minute snapshot should be taken. - /// Resource size in bytes, current storage usage for the volume in bytes. - /// Keeps track of any properties unknown to the library. - internal SnapshotPolicyHourlySchedule(int? snapshotsToKeep, int? minute, long? usedBytes, IDictionary serializedAdditionalRawData) - { - SnapshotsToKeep = snapshotsToKeep; - Minute = minute; - UsedBytes = usedBytes; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Hourly snapshot count to keep. - public int? SnapshotsToKeep { get; set; } - /// Indicates which minute snapshot should be taken. - public int? Minute { get; set; } - /// Resource size in bytes, current storage usage for the volume in bytes. - public long? UsedBytes { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyMonthlySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyMonthlySchedule.Serialization.cs deleted file mode 100644 index dabb20024cb7..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyMonthlySchedule.Serialization.cs +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class SnapshotPolicyMonthlySchedule : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SnapshotPolicyMonthlySchedule)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SnapshotsToKeep)) - { - writer.WritePropertyName("snapshotsToKeep"u8); - writer.WriteNumberValue(SnapshotsToKeep.Value); - } - if (Optional.IsDefined(DaysOfMonth)) - { - writer.WritePropertyName("daysOfMonth"u8); - writer.WriteStringValue(DaysOfMonth); - } - if (Optional.IsDefined(Hour)) - { - writer.WritePropertyName("hour"u8); - writer.WriteNumberValue(Hour.Value); - } - if (Optional.IsDefined(Minute)) - { - writer.WritePropertyName("minute"u8); - writer.WriteNumberValue(Minute.Value); - } - if (Optional.IsDefined(UsedBytes)) - { - writer.WritePropertyName("usedBytes"u8); - writer.WriteNumberValue(UsedBytes.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SnapshotPolicyMonthlySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SnapshotPolicyMonthlySchedule)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSnapshotPolicyMonthlySchedule(document.RootElement, options); - } - - internal static SnapshotPolicyMonthlySchedule DeserializeSnapshotPolicyMonthlySchedule(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? snapshotsToKeep = default; - string daysOfMonth = default; - int? hour = default; - int? minute = default; - long? usedBytes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("snapshotsToKeep"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - snapshotsToKeep = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("daysOfMonth"u8)) - { - daysOfMonth = property.Value.GetString(); - continue; - } - if (property.NameEquals("hour"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hour = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("minute"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minute = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("usedBytes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - usedBytes = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SnapshotPolicyMonthlySchedule( - snapshotsToKeep, - daysOfMonth, - hour, - minute, - usedBytes, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(SnapshotPolicyMonthlySchedule)} does not support writing '{options.Format}' format."); - } - } - - SnapshotPolicyMonthlySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSnapshotPolicyMonthlySchedule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SnapshotPolicyMonthlySchedule)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyMonthlySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyMonthlySchedule.cs deleted file mode 100644 index 544524d8f380..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyMonthlySchedule.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Monthly Schedule properties. - public partial class SnapshotPolicyMonthlySchedule - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public SnapshotPolicyMonthlySchedule() - { - } - - /// Initializes a new instance of . - /// Monthly snapshot count to keep. - /// Indicates which days of the month snapshot should be taken. A comma delimited string. - /// Indicates which hour in UTC timezone a snapshot should be taken. - /// Indicates which minute snapshot should be taken. - /// Resource size in bytes, current storage usage for the volume in bytes. - /// Keeps track of any properties unknown to the library. - internal SnapshotPolicyMonthlySchedule(int? snapshotsToKeep, string daysOfMonth, int? hour, int? minute, long? usedBytes, IDictionary serializedAdditionalRawData) - { - SnapshotsToKeep = snapshotsToKeep; - DaysOfMonth = daysOfMonth; - Hour = hour; - Minute = minute; - UsedBytes = usedBytes; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Monthly snapshot count to keep. - public int? SnapshotsToKeep { get; set; } - /// Indicates which days of the month snapshot should be taken. A comma delimited string. - public string DaysOfMonth { get; set; } - /// Indicates which hour in UTC timezone a snapshot should be taken. - public int? Hour { get; set; } - /// Indicates which minute snapshot should be taken. - public int? Minute { get; set; } - /// Resource size in bytes, current storage usage for the volume in bytes. - public long? UsedBytes { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyPatch.Serialization.cs index dcb826b2f0cc..247440911dda 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyPatch.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyPatch.Serialization.cs @@ -8,17 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - public partial class SnapshotPolicyPatch : IUtf8JsonSerializable, IJsonModel + /// Snapshot policy Details for create and update. + public partial class SnapshotPolicyPatch : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,217 +28,177 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The JSON writer. /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SnapshotPolicyPatch)} does not support writing '{format}' format."); } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(HourlySchedule)) + if (Optional.IsDefined(Location)) { - writer.WritePropertyName("hourlySchedule"u8); - writer.WriteObjectValue(HourlySchedule, options); + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); } - if (Optional.IsDefined(DailySchedule)) + if (options.Format != "W" && Optional.IsDefined(Id)) { - writer.WritePropertyName("dailySchedule"u8); - writer.WriteObjectValue(DailySchedule, options); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); } - if (Optional.IsDefined(WeeklySchedule)) + if (options.Format != "W" && Optional.IsDefined(Name)) { - writer.WritePropertyName("weeklySchedule"u8); - writer.WriteObjectValue(WeeklySchedule, options); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); } - if (Optional.IsDefined(MonthlySchedule)) + if (options.Format != "W" && Optional.IsDefined(Type)) { - writer.WritePropertyName("monthlySchedule"u8); - writer.WriteObjectValue(MonthlySchedule, options); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); } - if (Optional.IsDefined(IsEnabled)) + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } } - writer.WriteEndObject(); } - SnapshotPolicyPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SnapshotPolicyPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SnapshotPolicyPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SnapshotPolicyPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSnapshotPolicyPatch(document.RootElement, options); } - internal static SnapshotPolicyPatch DeserializeSnapshotPolicyPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SnapshotPolicyPatch DeserializeSnapshotPolicyPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; + string location = default; + string id = default; string name = default; - ResourceType type = default; - SystemData systemData = default; - SnapshotPolicyHourlySchedule hourlySchedule = default; - SnapshotPolicyDailySchedule dailySchedule = default; - SnapshotPolicyWeeklySchedule weeklySchedule = default; - SnapshotPolicyMonthlySchedule monthlySchedule = default; - bool? enabled = default; - string provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + string @type = default; + IDictionary tags = default; + SnapshotPolicyProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("location"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + location = prop.Value.GetString(); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("id"u8)) { - name = property.Value.GetString(); + id = prop.Value.GetString(); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("name"u8)) { - type = new ResourceType(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("type"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + @type = prop.Value.GetString(); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("hourlySchedule"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hourlySchedule = SnapshotPolicyHourlySchedule.DeserializeSnapshotPolicyHourlySchedule(property0.Value, options); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("dailySchedule"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dailySchedule = SnapshotPolicyDailySchedule.DeserializeSnapshotPolicyDailySchedule(property0.Value, options); - continue; - } - if (property0.NameEquals("weeklySchedule"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - weeklySchedule = SnapshotPolicyWeeklySchedule.DeserializeSnapshotPolicyWeeklySchedule(property0.Value, options); - continue; - } - if (property0.NameEquals("monthlySchedule"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - monthlySchedule = SnapshotPolicyMonthlySchedule.DeserializeSnapshotPolicyMonthlySchedule(property0.Value, options); - continue; - } - if (property0.NameEquals("enabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SnapshotPolicyProperties.DeserializeSnapshotPolicyProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new SnapshotPolicyPatch( + location, id, name, - type, - systemData, + @type, tags ?? new ChangeTrackingDictionary(), - location, - hourlySchedule, - dailySchedule, - weeklySchedule, - monthlySchedule, - enabled, - provisioningState, - serializedAdditionalRawData); + properties, + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -248,15 +208,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - SnapshotPolicyPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + SnapshotPolicyPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SnapshotPolicyPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeSnapshotPolicyPatch(document.RootElement, options); } default: @@ -264,6 +229,19 @@ SnapshotPolicyPatch IPersistableModel.Create(BinaryData dat } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(SnapshotPolicyPatch snapshotPolicyPatch) + { + if (snapshotPolicyPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(snapshotPolicyPatch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyPatch.cs index b86f7f10b1ce..c1f053137d30 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyPatch.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyPatch.cs @@ -7,93 +7,151 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Snapshot policy Details for create and update. - public partial class SnapshotPolicyPatch : TrackedResourceData + public partial class SnapshotPolicyPatch { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. - public SnapshotPolicyPatch(AzureLocation location) : base(location) + public SnapshotPolicyPatch() { + Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Schedule for hourly snapshots. - /// Schedule for daily snapshots. - /// Schedule for weekly snapshots. - /// Schedule for monthly snapshots. - /// The property to decide policy is enabled or not. - /// Azure lifecycle management. - /// Keeps track of any properties unknown to the library. - internal SnapshotPolicyPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SnapshotPolicyHourlySchedule hourlySchedule, SnapshotPolicyDailySchedule dailySchedule, SnapshotPolicyWeeklySchedule weeklySchedule, SnapshotPolicyMonthlySchedule monthlySchedule, bool? isEnabled, string provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// Snapshot Policy properties. + /// Keeps track of any properties unknown to the library. + internal SnapshotPolicyPatch(string location, string id, string name, string @type, IDictionary tags, SnapshotPolicyProperties properties, IDictionary additionalBinaryDataProperties) { - HourlySchedule = hourlySchedule; - DailySchedule = dailySchedule; - WeeklySchedule = weeklySchedule; - MonthlySchedule = monthlySchedule; - IsEnabled = isEnabled; - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; + Location = location; + Id = id; + Name = name; + Type = @type; + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Initializes a new instance of for deserialization. - internal SnapshotPolicyPatch() + /// Resource location. + public string Location { get; set; } + + /// Resource Id. + public string Id { get; } + + /// Resource name. + public string Name { get; } + + /// Resource type. + public string Type { get; } + + /// Resource tags. + public IDictionary Tags { get; } + + /// Snapshot Policy properties. + internal SnapshotPolicyProperties Properties { get; set; } + + /// Schedule for hourly snapshots. + public HourlySchedule HourlySchedule { + get + { + return Properties is null ? default : Properties.HourlySchedule; + } + set + { + if (Properties is null) + { + Properties = new SnapshotPolicyProperties(); + } + Properties.HourlySchedule = value; + } } - /// Schedule for hourly snapshots. - public SnapshotPolicyHourlySchedule HourlySchedule { get; set; } /// Schedule for daily snapshots. - public SnapshotPolicyDailySchedule DailySchedule { get; set; } + public DailySchedule DailySchedule + { + get + { + return Properties is null ? default : Properties.DailySchedule; + } + set + { + if (Properties is null) + { + Properties = new SnapshotPolicyProperties(); + } + Properties.DailySchedule = value; + } + } + /// Schedule for weekly snapshots. - public SnapshotPolicyWeeklySchedule WeeklySchedule { get; set; } + public WeeklySchedule WeeklySchedule + { + get + { + return Properties is null ? default : Properties.WeeklySchedule; + } + set + { + if (Properties is null) + { + Properties = new SnapshotPolicyProperties(); + } + Properties.WeeklySchedule = value; + } + } + /// Schedule for monthly snapshots. - public SnapshotPolicyMonthlySchedule MonthlySchedule { get; set; } + public MonthlySchedule MonthlySchedule + { + get + { + return Properties is null ? default : Properties.MonthlySchedule; + } + set + { + if (Properties is null) + { + Properties = new SnapshotPolicyProperties(); + } + Properties.MonthlySchedule = value; + } + } + /// The property to decide policy is enabled or not. - public bool? IsEnabled { get; set; } + public bool? Enabled + { + get + { + return Properties is null ? default : Properties.Enabled; + } + set + { + if (Properties is null) + { + Properties = new SnapshotPolicyProperties(); + } + Properties.Enabled = value.Value; + } + } + /// Azure lifecycle management. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyProperties.Serialization.cs new file mode 100644 index 000000000000..6dffe02576c2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyProperties.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Snapshot policy properties. + internal partial class SnapshotPolicyProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SnapshotPolicyProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(HourlySchedule)) + { + writer.WritePropertyName("hourlySchedule"u8); + writer.WriteObjectValue(HourlySchedule, options); + } + if (Optional.IsDefined(DailySchedule)) + { + writer.WritePropertyName("dailySchedule"u8); + writer.WriteObjectValue(DailySchedule, options); + } + if (Optional.IsDefined(WeeklySchedule)) + { + writer.WritePropertyName("weeklySchedule"u8); + writer.WriteObjectValue(WeeklySchedule, options); + } + if (Optional.IsDefined(MonthlySchedule)) + { + writer.WritePropertyName("monthlySchedule"u8); + writer.WriteObjectValue(MonthlySchedule, options); + } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SnapshotPolicyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SnapshotPolicyProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SnapshotPolicyProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotPolicyProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SnapshotPolicyProperties DeserializeSnapshotPolicyProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HourlySchedule hourlySchedule = default; + DailySchedule dailySchedule = default; + WeeklySchedule weeklySchedule = default; + MonthlySchedule monthlySchedule = default; + bool? enabled = default; + string provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("hourlySchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hourlySchedule = HourlySchedule.DeserializeHourlySchedule(prop.Value, options); + continue; + } + if (prop.NameEquals("dailySchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dailySchedule = DailySchedule.DeserializeDailySchedule(prop.Value, options); + continue; + } + if (prop.NameEquals("weeklySchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + weeklySchedule = WeeklySchedule.DeserializeWeeklySchedule(prop.Value, options); + continue; + } + if (prop.NameEquals("monthlySchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + monthlySchedule = MonthlySchedule.DeserializeMonthlySchedule(prop.Value, options); + continue; + } + if (prop.NameEquals("enabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SnapshotPolicyProperties( + hourlySchedule, + dailySchedule, + weeklySchedule, + monthlySchedule, + enabled, + provisioningState, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SnapshotPolicyProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SnapshotPolicyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SnapshotPolicyProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSnapshotPolicyProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SnapshotPolicyProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyProperties.cs new file mode 100644 index 000000000000..1f5335ff870d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyProperties.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Snapshot policy properties. + internal partial class SnapshotPolicyProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SnapshotPolicyProperties() + { + } + + /// Initializes a new instance of . + /// Schedule for hourly snapshots. + /// Schedule for daily snapshots. + /// Schedule for weekly snapshots. + /// Schedule for monthly snapshots. + /// The property to decide policy is enabled or not. + /// Azure lifecycle management. + /// Keeps track of any properties unknown to the library. + internal SnapshotPolicyProperties(HourlySchedule hourlySchedule, DailySchedule dailySchedule, WeeklySchedule weeklySchedule, MonthlySchedule monthlySchedule, bool? enabled, string provisioningState, IDictionary additionalBinaryDataProperties) + { + HourlySchedule = hourlySchedule; + DailySchedule = dailySchedule; + WeeklySchedule = weeklySchedule; + MonthlySchedule = monthlySchedule; + Enabled = enabled; + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Schedule for hourly snapshots. + public HourlySchedule HourlySchedule { get; set; } + + /// Schedule for daily snapshots. + public DailySchedule DailySchedule { get; set; } + + /// Schedule for weekly snapshots. + public WeeklySchedule WeeklySchedule { get; set; } + + /// Schedule for monthly snapshots. + public MonthlySchedule MonthlySchedule { get; set; } + + /// The property to decide policy is enabled or not. + public bool? Enabled { get; set; } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyVolumeList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyVolumeList.Serialization.cs index e1ae6d4236ea..47414c0a3a27 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyVolumeList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyVolumeList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class SnapshotPolicyVolumeList : IUtf8JsonSerializable, IJsonModel + /// Volumes associated with snapshot policy. + public partial class SnapshotPolicyVolumeList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal SnapshotPolicyVolumeList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SnapshotPolicyVolumeList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (VolumeData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SnapshotPolicyVolumeList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SnapshotPolicyVolumeList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SnapshotPolicyVolumeList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SnapshotPolicyVolumeList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSnapshotPolicyVolumeList(document.RootElement, options); } - internal static SnapshotPolicyVolumeList DeserializeSnapshotPolicyVolumeList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SnapshotPolicyVolumeList DeserializeSnapshotPolicyVolumeList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - continue; + array.Add(VolumeData.DeserializeVolumeData(item, options)); } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { - array.Add(NetAppVolumeData.DeserializeNetAppVolumeData(item, options)); + continue; } - value = array; + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new SnapshotPolicyVolumeList(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new SnapshotPolicyVolumeList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - SnapshotPolicyVolumeList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + SnapshotPolicyVolumeList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SnapshotPolicyVolumeList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeSnapshotPolicyVolumeList(document.RootElement, options); } default: @@ -138,6 +163,15 @@ SnapshotPolicyVolumeList IPersistableModel.Create(Bina } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static SnapshotPolicyVolumeList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSnapshotPolicyVolumeList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyVolumeList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyVolumeList.cs index 018bdb7ee6e2..7f28a722ed70 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyVolumeList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyVolumeList.cs @@ -7,60 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Volumes associated with snapshot policy. - internal partial class SnapshotPolicyVolumeList + public partial class SnapshotPolicyVolumeList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal SnapshotPolicyVolumeList() + /// The Volume items on this page. + internal SnapshotPolicyVolumeList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// List of volumes. - /// Keeps track of any properties unknown to the library. - internal SnapshotPolicyVolumeList(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// The Volume items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SnapshotPolicyVolumeList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// List of volumes. - public IReadOnlyList Value { get; } + /// The Volume items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyWeeklySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyWeeklySchedule.Serialization.cs deleted file mode 100644 index 52ee4dcb003a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyWeeklySchedule.Serialization.cs +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class SnapshotPolicyWeeklySchedule : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SnapshotPolicyWeeklySchedule)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SnapshotsToKeep)) - { - writer.WritePropertyName("snapshotsToKeep"u8); - writer.WriteNumberValue(SnapshotsToKeep.Value); - } - if (Optional.IsDefined(Day)) - { - writer.WritePropertyName("day"u8); - writer.WriteStringValue(Day); - } - if (Optional.IsDefined(Hour)) - { - writer.WritePropertyName("hour"u8); - writer.WriteNumberValue(Hour.Value); - } - if (Optional.IsDefined(Minute)) - { - writer.WritePropertyName("minute"u8); - writer.WriteNumberValue(Minute.Value); - } - if (Optional.IsDefined(UsedBytes)) - { - writer.WritePropertyName("usedBytes"u8); - writer.WriteNumberValue(UsedBytes.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SnapshotPolicyWeeklySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SnapshotPolicyWeeklySchedule)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSnapshotPolicyWeeklySchedule(document.RootElement, options); - } - - internal static SnapshotPolicyWeeklySchedule DeserializeSnapshotPolicyWeeklySchedule(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? snapshotsToKeep = default; - string day = default; - int? hour = default; - int? minute = default; - long? usedBytes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("snapshotsToKeep"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - snapshotsToKeep = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("day"u8)) - { - day = property.Value.GetString(); - continue; - } - if (property.NameEquals("hour"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hour = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("minute"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minute = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("usedBytes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - usedBytes = property.Value.GetInt64(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SnapshotPolicyWeeklySchedule( - snapshotsToKeep, - day, - hour, - minute, - usedBytes, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(SnapshotPolicyWeeklySchedule)} does not support writing '{options.Format}' format."); - } - } - - SnapshotPolicyWeeklySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSnapshotPolicyWeeklySchedule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SnapshotPolicyWeeklySchedule)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyWeeklySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyWeeklySchedule.cs deleted file mode 100644 index 408ab0d64f89..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotPolicyWeeklySchedule.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Weekly Schedule properties, make a snapshot every week at a specific day or days. - public partial class SnapshotPolicyWeeklySchedule - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public SnapshotPolicyWeeklySchedule() - { - } - - /// Initializes a new instance of . - /// Weekly snapshot count to keep. - /// Indicates which weekdays snapshot should be taken, accepts a comma separated list of week day names in english. - /// Indicates which hour in UTC timezone a snapshot should be taken. - /// Indicates which minute snapshot should be taken. - /// Resource size in bytes, current storage usage for the volume in bytes. - /// Keeps track of any properties unknown to the library. - internal SnapshotPolicyWeeklySchedule(int? snapshotsToKeep, string day, int? hour, int? minute, long? usedBytes, IDictionary serializedAdditionalRawData) - { - SnapshotsToKeep = snapshotsToKeep; - Day = day; - Hour = hour; - Minute = minute; - UsedBytes = usedBytes; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Weekly snapshot count to keep. - public int? SnapshotsToKeep { get; set; } - /// Indicates which weekdays snapshot should be taken, accepts a comma separated list of week day names in english. - public string Day { get; set; } - /// Indicates which hour in UTC timezone a snapshot should be taken. - public int? Hour { get; set; } - /// Indicates which minute snapshot should be taken. - public int? Minute { get; set; } - /// Resource size in bytes, current storage usage for the volume in bytes. - public long? UsedBytes { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotProperties.Serialization.cs new file mode 100644 index 000000000000..d655a1919886 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotProperties.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Snapshot properties. + internal partial class SnapshotProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SnapshotProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(SnapshotId)) + { + writer.WritePropertyName("snapshotId"u8); + writer.WriteStringValue(SnapshotId); + } + if (options.Format != "W" && Optional.IsDefined(Created)) + { + writer.WritePropertyName("created"u8); + writer.WriteStringValue(Created.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SnapshotProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SnapshotProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SnapshotProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SnapshotProperties DeserializeSnapshotProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string snapshotId = default; + DateTimeOffset? created = default; + string provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotId"u8)) + { + snapshotId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("created"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + created = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SnapshotProperties(snapshotId, created, provisioningState, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SnapshotProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SnapshotProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SnapshotProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSnapshotProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SnapshotProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotProperties.cs new file mode 100644 index 000000000000..94caf081f7e7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotProperties.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Snapshot properties. + internal partial class SnapshotProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SnapshotProperties() + { + } + + /// Initializes a new instance of . + /// UUID v4 used to identify the Snapshot. + /// The creation date of the snapshot. + /// Azure lifecycle management. + /// Keeps track of any properties unknown to the library. + internal SnapshotProperties(string snapshotId, DateTimeOffset? created, string provisioningState, IDictionary additionalBinaryDataProperties) + { + SnapshotId = snapshotId; + Created = created; + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// UUID v4 used to identify the Snapshot. + public string SnapshotId { get; } + + /// The creation date of the snapshot. + public DateTimeOffset? Created { get; } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotRestoreFiles.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotRestoreFiles.Serialization.cs new file mode 100644 index 000000000000..0a0b06f5a34a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotRestoreFiles.Serialization.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Restore payload for Single File Snapshot Restore. + public partial class SnapshotRestoreFiles : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal SnapshotRestoreFiles() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SnapshotRestoreFiles)} does not support writing '{format}' format."); + } + writer.WritePropertyName("filePaths"u8); + writer.WriteStartArray(); + foreach (string item in FilePaths) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DestinationPath)) + { + writer.WritePropertyName("destinationPath"u8); + writer.WriteStringValue(DestinationPath); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SnapshotRestoreFiles IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SnapshotRestoreFiles JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SnapshotRestoreFiles)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotRestoreFiles(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SnapshotRestoreFiles DeserializeSnapshotRestoreFiles(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList filePaths = default; + string destinationPath = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("filePaths"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + filePaths = array; + continue; + } + if (prop.NameEquals("destinationPath"u8)) + { + destinationPath = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SnapshotRestoreFiles(filePaths, destinationPath, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SnapshotRestoreFiles)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SnapshotRestoreFiles IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SnapshotRestoreFiles PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSnapshotRestoreFiles(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SnapshotRestoreFiles)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(SnapshotRestoreFiles snapshotRestoreFiles) + { + if (snapshotRestoreFiles == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(snapshotRestoreFiles, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotRestoreFiles.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotRestoreFiles.cs new file mode 100644 index 000000000000..a92c3a39770f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotRestoreFiles.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Restore payload for Single File Snapshot Restore. + public partial class SnapshotRestoreFiles + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// List of files to be restored. + /// is null. + public SnapshotRestoreFiles(IEnumerable filePaths) + { + Argument.AssertNotNull(filePaths, nameof(filePaths)); + + FilePaths = filePaths.ToList(); + } + + /// Initializes a new instance of . + /// List of files to be restored. + /// Destination folder where the files will be restored. + /// Keeps track of any properties unknown to the library. + internal SnapshotRestoreFiles(IList filePaths, string destinationPath, IDictionary additionalBinaryDataProperties) + { + FilePaths = filePaths; + DestinationPath = destinationPath; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// List of files to be restored. + public IList FilePaths { get; } + + /// Destination folder where the files will be restored. + public string DestinationPath { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotUsage.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotUsage.cs new file mode 100644 index 000000000000..be0f0c97c601 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotUsage.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Snapshot usage for backup. + public readonly partial struct SnapshotUsage : IEquatable + { + private readonly string _value; + /// Value indicating an existing snapshot is used. + private const string UseExistingSnapshotValue = "UseExistingSnapshot"; + /// Value indicating a new snapshot is created. + private const string CreateNewSnapshotValue = "CreateNewSnapshot"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public SnapshotUsage(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Value indicating an existing snapshot is used. + public static SnapshotUsage UseExistingSnapshot { get; } = new SnapshotUsage(UseExistingSnapshotValue); + + /// Value indicating a new snapshot is created. + public static SnapshotUsage CreateNewSnapshot { get; } = new SnapshotUsage(CreateNewSnapshotValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(SnapshotUsage left, SnapshotUsage right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(SnapshotUsage left, SnapshotUsage right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator SnapshotUsage(string value) => new SnapshotUsage(value); + + /// Converts a string to a . + /// The value. + public static implicit operator SnapshotUsage?(string value) => value == null ? null : new SnapshotUsage(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SnapshotUsage other && Equals(other); + + /// + public bool Equals(SnapshotUsage other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotsList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotsList.Serialization.cs index dee768d8c8dc..9bee3b5573d6 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotsList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotsList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class SnapshotsList : IUtf8JsonSerializable, IJsonModel + /// List of Snapshots. + internal partial class SnapshotsList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal SnapshotsList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SnapshotsList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (SnapshotData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SnapshotsList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SnapshotsList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SnapshotsList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SnapshotsList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSnapshotsList(document.RootElement, options); } - internal static SnapshotsList DeserializeSnapshotsList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SnapshotsList DeserializeSnapshotsList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - continue; + array.Add(SnapshotData.DeserializeSnapshotData(item, options)); } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { - array.Add(NetAppVolumeSnapshotData.DeserializeNetAppVolumeSnapshotData(item, options)); + continue; } - value = array; + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new SnapshotsList(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new SnapshotsList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions optio } } - SnapshotsList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + SnapshotsList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SnapshotsList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeSnapshotsList(document.RootElement, options); } default: @@ -138,6 +163,15 @@ SnapshotsList IPersistableModel.Create(BinaryData data, ModelRead } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static SnapshotsList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSnapshotsList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotsList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotsList.cs index f0bd6fbcb558..da59a5462c27 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotsList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SnapshotsList.cs @@ -7,60 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of Snapshots. internal partial class SnapshotsList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal SnapshotsList() + /// The Snapshot items on this page. + internal SnapshotsList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// A list of Snapshots. - /// Keeps track of any properties unknown to the library. - internal SnapshotsList(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// The Snapshot items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SnapshotsList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// A list of Snapshots. - public IReadOnlyList Value { get; } + /// The Snapshot items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeInfoPatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeInfoPatch.Serialization.cs new file mode 100644 index 000000000000..a489c833e40f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeInfoPatch.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Subvolume Patch Request properties. + public partial class SubvolumeInfoPatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumeInfoPatch)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SubvolumeInfoPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SubvolumeInfoPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumeInfoPatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubvolumeInfoPatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SubvolumeInfoPatch DeserializeSubvolumeInfoPatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SubvolumePatchParams properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SubvolumePatchParams.DeserializeSubvolumePatchParams(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SubvolumeInfoPatch(properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SubvolumeInfoPatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SubvolumeInfoPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SubvolumeInfoPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSubvolumeInfoPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubvolumeInfoPatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(SubvolumeInfoPatch subvolumeInfoPatch) + { + if (subvolumeInfoPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(subvolumeInfoPatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeInfoPatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeInfoPatch.cs new file mode 100644 index 000000000000..e37dc8cf4f4a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeInfoPatch.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Subvolume Patch Request properties. + public partial class SubvolumeInfoPatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SubvolumeInfoPatch() + { + } + + /// Initializes a new instance of . + /// Subvolume Properties. + /// Keeps track of any properties unknown to the library. + internal SubvolumeInfoPatch(SubvolumePatchParams properties, IDictionary additionalBinaryDataProperties) + { + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Subvolume Properties. + internal SubvolumePatchParams Properties { get; set; } + + /// Truncate subvolume to the provided size in bytes. + public long? Size + { + get + { + return Properties is null ? default : Properties.Size; + } + set + { + if (Properties is null) + { + Properties = new SubvolumePatchParams(); + } + Properties.Size = value.Value; + } + } + + /// path to the subvolume. + public string Path + { + get + { + return Properties is null ? default : Properties.Path; + } + set + { + if (Properties is null) + { + Properties = new SubvolumePatchParams(); + } + Properties.Path = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModel.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModel.Serialization.cs new file mode 100644 index 000000000000..c246acdffb3a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModel.Serialization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Result of the post subvolume and action is to get metadata of the subvolume. + public partial class SubvolumeModel : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumeModel)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SubvolumeModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SubvolumeModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumeModel)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubvolumeModel(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SubvolumeModel DeserializeSubvolumeModel(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string name = default; + string @type = default; + SubvolumeModelProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + @type = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SubvolumeModelProperties.DeserializeSubvolumeModelProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SubvolumeModel(id, name, @type, properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SubvolumeModel)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SubvolumeModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SubvolumeModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSubvolumeModel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubvolumeModel)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static SubvolumeModel FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSubvolumeModel(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModel.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModel.cs new file mode 100644 index 000000000000..2396028ce4f0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModel.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Result of the post subvolume and action is to get metadata of the subvolume. + public partial class SubvolumeModel + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal SubvolumeModel() + { + } + + /// Initializes a new instance of . + /// Resource Id. + /// Resource name. + /// Resource type. + /// It represents the minimal properties of the subvolume. + /// Keeps track of any properties unknown to the library. + internal SubvolumeModel(string id, string name, string @type, SubvolumeModelProperties properties, IDictionary additionalBinaryDataProperties) + { + Id = id; + Name = name; + Type = @type; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource Id. + public string Id { get; } + + /// Resource name. + public string Name { get; } + + /// Resource type. + public string Type { get; } + + /// It represents the minimal properties of the subvolume. + internal SubvolumeModelProperties Properties { get; } + + /// Path to the subvolume. + public string Path + { + get + { + return Properties.Path; + } + } + + /// Path to the parent subvolume. + public string ParentPath + { + get + { + return Properties.ParentPath; + } + } + + /// Size of subvolume. + public long? Size + { + get + { + return Properties.Size; + } + } + + /// Bytes used. + public long? BytesUsed + { + get + { + return Properties.BytesUsed; + } + } + + /// Permissions of the subvolume. + public string Permissions + { + get + { + return Properties.Permissions; + } + } + + /// Creation time and date. + public DateTimeOffset? CreationTimeStamp + { + get + { + return Properties.CreationTimeStamp; + } + } + + /// Most recent access time and date. + public DateTimeOffset? AccessedTimeStamp + { + get + { + return Properties.AccessedTimeStamp; + } + } + + /// Most recent modification time and date. + public DateTimeOffset? ModifiedTimeStamp + { + get + { + return Properties.ModifiedTimeStamp; + } + } + + /// Most recent change time and date. + public DateTimeOffset? ChangedTimeStamp + { + get + { + return Properties.ChangedTimeStamp; + } + } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties.ProvisioningState; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModelProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModelProperties.Serialization.cs new file mode 100644 index 000000000000..8c1e98b1b655 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModelProperties.Serialization.cs @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties which represents actual subvolume model which is stored as a file in the system. + internal partial class SubvolumeModelProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumeModelProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(ParentPath)) + { + writer.WritePropertyName("parentPath"u8); + writer.WriteStringValue(ParentPath); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(BytesUsed)) + { + writer.WritePropertyName("bytesUsed"u8); + writer.WriteNumberValue(BytesUsed.Value); + } + if (Optional.IsDefined(Permissions)) + { + writer.WritePropertyName("permissions"u8); + writer.WriteStringValue(Permissions); + } + if (Optional.IsDefined(CreationTimeStamp)) + { + writer.WritePropertyName("creationTimeStamp"u8); + writer.WriteStringValue(CreationTimeStamp.Value, "O"); + } + if (Optional.IsDefined(AccessedTimeStamp)) + { + writer.WritePropertyName("accessedTimeStamp"u8); + writer.WriteStringValue(AccessedTimeStamp.Value, "O"); + } + if (Optional.IsDefined(ModifiedTimeStamp)) + { + writer.WritePropertyName("modifiedTimeStamp"u8); + writer.WriteStringValue(ModifiedTimeStamp.Value, "O"); + } + if (Optional.IsDefined(ChangedTimeStamp)) + { + writer.WritePropertyName("changedTimeStamp"u8); + writer.WriteStringValue(ChangedTimeStamp.Value, "O"); + } + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SubvolumeModelProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SubvolumeModelProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumeModelProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubvolumeModelProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SubvolumeModelProperties DeserializeSubvolumeModelProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string path = default; + string parentPath = default; + long? size = default; + long? bytesUsed = default; + string permissions = default; + DateTimeOffset? creationTimeStamp = default; + DateTimeOffset? accessedTimeStamp = default; + DateTimeOffset? modifiedTimeStamp = default; + DateTimeOffset? changedTimeStamp = default; + string provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("path"u8)) + { + path = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("parentPath"u8)) + { + parentPath = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("size"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("bytesUsed"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bytesUsed = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("permissions"u8)) + { + permissions = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("creationTimeStamp"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTimeStamp = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("accessedTimeStamp"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + accessedTimeStamp = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("modifiedTimeStamp"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modifiedTimeStamp = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("changedTimeStamp"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + changedTimeStamp = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SubvolumeModelProperties( + path, + parentPath, + size, + bytesUsed, + permissions, + creationTimeStamp, + accessedTimeStamp, + modifiedTimeStamp, + changedTimeStamp, + provisioningState, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SubvolumeModelProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SubvolumeModelProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SubvolumeModelProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSubvolumeModelProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubvolumeModelProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModelProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModelProperties.cs new file mode 100644 index 000000000000..47af03739716 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeModelProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Properties which represents actual subvolume model which is stored as a file in the system. + internal partial class SubvolumeModelProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal SubvolumeModelProperties() + { + } + + /// Initializes a new instance of . + /// Path to the subvolume. + /// Path to the parent subvolume. + /// Size of subvolume. + /// Bytes used. + /// Permissions of the subvolume. + /// Creation time and date. + /// Most recent access time and date. + /// Most recent modification time and date. + /// Most recent change time and date. + /// Azure lifecycle management. + /// Keeps track of any properties unknown to the library. + internal SubvolumeModelProperties(string path, string parentPath, long? size, long? bytesUsed, string permissions, DateTimeOffset? creationTimeStamp, DateTimeOffset? accessedTimeStamp, DateTimeOffset? modifiedTimeStamp, DateTimeOffset? changedTimeStamp, string provisioningState, IDictionary additionalBinaryDataProperties) + { + Path = path; + ParentPath = parentPath; + Size = size; + BytesUsed = bytesUsed; + Permissions = permissions; + CreationTimeStamp = creationTimeStamp; + AccessedTimeStamp = accessedTimeStamp; + ModifiedTimeStamp = modifiedTimeStamp; + ChangedTimeStamp = changedTimeStamp; + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Path to the subvolume. + public string Path { get; } + + /// Path to the parent subvolume. + public string ParentPath { get; } + + /// Size of subvolume. + public long? Size { get; } + + /// Bytes used. + public long? BytesUsed { get; } + + /// Permissions of the subvolume. + public string Permissions { get; } + + /// Creation time and date. + public DateTimeOffset? CreationTimeStamp { get; } + + /// Most recent access time and date. + public DateTimeOffset? AccessedTimeStamp { get; } + + /// Most recent modification time and date. + public DateTimeOffset? ModifiedTimeStamp { get; } + + /// Most recent change time and date. + public DateTimeOffset? ChangedTimeStamp { get; } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumePatchParams.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumePatchParams.Serialization.cs new file mode 100644 index 000000000000..c3e1b92319d8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumePatchParams.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Parameters with which a subvolume can be updated. + internal partial class SubvolumePatchParams : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumePatchParams)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SubvolumePatchParams IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SubvolumePatchParams JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumePatchParams)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubvolumePatchParams(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SubvolumePatchParams DeserializeSubvolumePatchParams(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? size = default; + string path = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("size"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + size = null; + continue; + } + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("path"u8)) + { + path = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SubvolumePatchParams(size, path, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SubvolumePatchParams)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SubvolumePatchParams IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SubvolumePatchParams PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSubvolumePatchParams(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubvolumePatchParams)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumePatchParams.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumePatchParams.cs new file mode 100644 index 000000000000..f4769e098a13 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumePatchParams.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Parameters with which a subvolume can be updated. + internal partial class SubvolumePatchParams + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SubvolumePatchParams() + { + } + + /// Initializes a new instance of . + /// Truncate subvolume to the provided size in bytes. + /// path to the subvolume. + /// Keeps track of any properties unknown to the library. + internal SubvolumePatchParams(long? size, string path, IDictionary additionalBinaryDataProperties) + { + Size = size; + Path = path; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Truncate subvolume to the provided size in bytes. + public long? Size { get; set; } + + /// path to the subvolume. + public string Path { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeProperties.Serialization.cs new file mode 100644 index 000000000000..a9e9e9b6fddd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeProperties.Serialization.cs @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// This represents path associated with the subvolume. + internal partial class SubvolumeProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumeProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(ParentPath)) + { + writer.WritePropertyName("parentPath"u8); + writer.WriteStringValue(ParentPath); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SubvolumeProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SubvolumeProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumeProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubvolumeProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SubvolumeProperties DeserializeSubvolumeProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string path = default; + long? size = default; + string parentPath = default; + string provisioningState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("path"u8)) + { + path = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("size"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + size = null; + continue; + } + size = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("parentPath"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + parentPath = null; + continue; + } + parentPath = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SubvolumeProperties(path, size, parentPath, provisioningState, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SubvolumeProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SubvolumeProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SubvolumeProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSubvolumeProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubvolumeProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeProperties.cs new file mode 100644 index 000000000000..30cac6cdb2cb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumeProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// This represents path associated with the subvolume. + internal partial class SubvolumeProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SubvolumeProperties() + { + } + + /// Initializes a new instance of . + /// Path to the subvolume. + /// Truncate subvolume to the provided size in bytes. + /// parent path to the subvolume. + /// Azure lifecycle management. + /// Keeps track of any properties unknown to the library. + internal SubvolumeProperties(string path, long? size, string parentPath, string provisioningState, IDictionary additionalBinaryDataProperties) + { + Path = path; + Size = size; + ParentPath = parentPath; + ProvisioningState = provisioningState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Path to the subvolume. + public string Path { get; set; } + + /// Truncate subvolume to the provided size in bytes. + public long? Size { get; set; } + + /// parent path to the subvolume. + public string ParentPath { get; set; } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumesList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumesList.Serialization.cs index 05affa3cfee1..12eb2b1aa23a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumesList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumesList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class SubvolumesList : IUtf8JsonSerializable, IJsonModel + /// List of Subvolumes. + internal partial class SubvolumesList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal SubvolumesList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SubvolumesList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (SubvolumeInfoData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SubvolumesList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SubvolumesList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SubvolumesList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SubvolumesList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSubvolumesList(document.RootElement, options); } - internal static SubvolumesList DeserializeSubvolumesList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SubvolumesList DeserializeSubvolumesList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(NetAppSubvolumeInfoData.DeserializeNetAppSubvolumeInfoData(item, options)); + array.Add(SubvolumeInfoData.DeserializeSubvolumeInfoData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new SubvolumesList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new SubvolumesList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -133,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opti } } - SubvolumesList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + SubvolumesList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SubvolumesList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeSubvolumesList(document.RootElement, options); } default: @@ -149,6 +163,15 @@ SubvolumesList IPersistableModel.Create(BinaryData data, ModelRe } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static SubvolumesList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSubvolumesList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumesList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumesList.cs index 3eabb0cf57cb..662814118c16 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumesList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SubvolumesList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of Subvolumes. internal partial class SubvolumesList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal SubvolumesList() + /// The SubvolumeInfo items on this page. + internal SubvolumesList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// A list of Subvolumes. - /// URL to get the next set of results. - /// Keeps track of any properties unknown to the library. - internal SubvolumesList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The SubvolumeInfo items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SubvolumesList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// A list of Subvolumes. - public IReadOnlyList Value { get; } - /// URL to get the next set of results. - public string NextLink { get; } + /// The SubvolumeInfo items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SuspectFile.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SuspectFile.Serialization.cs new file mode 100644 index 000000000000..e6f977577662 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SuspectFile.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Suspect file information. + public partial class SuspectFile : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SuspectFile)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(SuspectFileName)) + { + writer.WritePropertyName("suspectFileName"u8); + writer.WriteStringValue(SuspectFileName); + } + if (options.Format != "W" && Optional.IsDefined(FileTimestamp)) + { + writer.WritePropertyName("fileTimestamp"u8); + writer.WriteStringValue(FileTimestamp.Value, "O"); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SuspectFile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SuspectFile JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SuspectFile)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSuspectFile(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SuspectFile DeserializeSuspectFile(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string suspectFileName = default; + DateTimeOffset? fileTimestamp = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("suspectFileName"u8)) + { + suspectFileName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("fileTimestamp"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileTimestamp = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SuspectFile(suspectFileName, fileTimestamp, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SuspectFile)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SuspectFile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SuspectFile PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSuspectFile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SuspectFile)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SuspectFile.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SuspectFile.cs new file mode 100644 index 000000000000..3c472a803e35 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SuspectFile.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Suspect file information. + public partial class SuspectFile + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal SuspectFile() + { + } + + /// Initializes a new instance of . + /// Suspect filename. + /// The creation date and time of the file. + /// Keeps track of any properties unknown to the library. + internal SuspectFile(string suspectFileName, DateTimeOffset? fileTimestamp, IDictionary additionalBinaryDataProperties) + { + SuspectFileName = suspectFileName; + FileTimestamp = fileTimestamp; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Suspect filename. + public string SuspectFileName { get; } + + /// The creation date and time of the file. + public DateTimeOffset? FileTimestamp { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResponse.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResponse.Serialization.cs new file mode 100644 index 000000000000..4bba43b39d33 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResponse.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Information about svm peering process. + public partial class SvmPeerCommandResponse : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SvmPeerCommandResponse)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SvmPeeringCommand)) + { + writer.WritePropertyName("svmPeeringCommand"u8); + writer.WriteStringValue(SvmPeeringCommand); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SvmPeerCommandResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SvmPeerCommandResponse JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SvmPeerCommandResponse)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSvmPeerCommandResponse(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SvmPeerCommandResponse DeserializeSvmPeerCommandResponse(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string svmPeeringCommand = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("svmPeeringCommand"u8)) + { + svmPeeringCommand = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SvmPeerCommandResponse(svmPeeringCommand, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SvmPeerCommandResponse)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SvmPeerCommandResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SvmPeerCommandResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSvmPeerCommandResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SvmPeerCommandResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static SvmPeerCommandResponse FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSvmPeerCommandResponse(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResponse.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResponse.cs new file mode 100644 index 000000000000..53958993ba07 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResponse.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Information about svm peering process. + public partial class SvmPeerCommandResponse + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal SvmPeerCommandResponse() + { + } + + /// Initializes a new instance of . + /// A command that needs to be run on the external ONTAP to accept svm peering. Will only be present if <code>svmPeeringStatus</code> is <code>pending</code>. + /// Keeps track of any properties unknown to the library. + internal SvmPeerCommandResponse(string svmPeeringCommand, IDictionary additionalBinaryDataProperties) + { + SvmPeeringCommand = svmPeeringCommand; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// A command that needs to be run on the external ONTAP to accept svm peering. Will only be present if <code>svmPeeringStatus</code> is <code>pending</code>. + public string SvmPeeringCommand { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResult.Serialization.cs deleted file mode 100644 index e31449a8b117..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResult.Serialization.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class SvmPeerCommandResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SvmPeerCommandResult)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SvmPeeringCommand)) - { - writer.WritePropertyName("svmPeeringCommand"u8); - writer.WriteStringValue(SvmPeeringCommand); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SvmPeerCommandResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(SvmPeerCommandResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSvmPeerCommandResult(document.RootElement, options); - } - - internal static SvmPeerCommandResult DeserializeSvmPeerCommandResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string svmPeeringCommand = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("svmPeeringCommand"u8)) - { - svmPeeringCommand = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SvmPeerCommandResult(svmPeeringCommand, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(SvmPeerCommandResult)} does not support writing '{options.Format}' format."); - } - } - - SvmPeerCommandResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeSvmPeerCommandResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SvmPeerCommandResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResult.cs deleted file mode 100644 index 21cde8c5b00e..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/SvmPeerCommandResult.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Information about svm peering process. - public partial class SvmPeerCommandResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal SvmPeerCommandResult() - { - } - - /// Initializes a new instance of . - /// A command that needs to be run on the external ONTAP to accept svm peering. Will only be present if <code>svmPeeringStatus</code> is <code>pending</code>. - /// Keeps track of any properties unknown to the library. - internal SvmPeerCommandResult(string svmPeeringCommand, IDictionary serializedAdditionalRawData) - { - SvmPeeringCommand = svmPeeringCommand; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A command that needs to be run on the external ONTAP to accept svm peering. Will only be present if <code>svmPeeringStatus</code> is <code>pending</code>. - public string SvmPeeringCommand { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Type.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Type.cs new file mode 100644 index 000000000000..42252ebc57e0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/Type.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Type of quota. + public readonly partial struct Type : IEquatable + { + private readonly string _value; + /// Default user quota. + private const string DefaultUserQuotaValue = "DefaultUserQuota"; + /// Default group quota. + private const string DefaultGroupQuotaValue = "DefaultGroupQuota"; + /// Individual user quota. + private const string IndividualUserQuotaValue = "IndividualUserQuota"; + /// Individual group quota. + private const string IndividualGroupQuotaValue = "IndividualGroupQuota"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public Type(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Default user quota. + public static Type DefaultUserQuota { get; } = new Type(DefaultUserQuotaValue); + + /// Default group quota. + public static Type DefaultGroupQuota { get; } = new Type(DefaultGroupQuotaValue); + + /// Individual user quota. + public static Type IndividualUserQuota { get; } = new Type(IndividualUserQuotaValue); + + /// Individual group quota. + public static Type IndividualGroupQuota { get; } = new Type(IndividualGroupQuotaValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(Type left, Type right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(Type left, Type right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator Type(string value) => new Type(value); + + /// Converts a string to a . + /// The value. + public static implicit operator Type?(string value) => value == null ? null : new Type(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Type other && Equals(other); + + /// + public bool Equals(Type other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetContent.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetContent.Serialization.cs deleted file mode 100644 index 02dd29073b3a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetContent.Serialization.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - public partial class UpdateNetworkSiblingSetContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateNetworkSiblingSetContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("networkSiblingSetId"u8); - writer.WriteStringValue(NetworkSiblingSetId); - writer.WritePropertyName("subnetId"u8); - writer.WriteStringValue(SubnetId); - writer.WritePropertyName("networkSiblingSetStateId"u8); - writer.WriteStringValue(NetworkSiblingSetStateId); - writer.WritePropertyName("networkFeatures"u8); - writer.WriteStringValue(NetworkFeatures.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - UpdateNetworkSiblingSetContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(UpdateNetworkSiblingSetContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpdateNetworkSiblingSetContent(document.RootElement, options); - } - - internal static UpdateNetworkSiblingSetContent DeserializeUpdateNetworkSiblingSetContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string networkSiblingSetId = default; - ResourceIdentifier subnetId = default; - string networkSiblingSetStateId = default; - NetAppNetworkFeature networkFeatures = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("networkSiblingSetId"u8)) - { - networkSiblingSetId = property.Value.GetString(); - continue; - } - if (property.NameEquals("subnetId"u8)) - { - subnetId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("networkSiblingSetStateId"u8)) - { - networkSiblingSetStateId = property.Value.GetString(); - continue; - } - if (property.NameEquals("networkFeatures"u8)) - { - networkFeatures = new NetAppNetworkFeature(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new UpdateNetworkSiblingSetContent(networkSiblingSetId, subnetId, networkSiblingSetStateId, networkFeatures, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(UpdateNetworkSiblingSetContent)} does not support writing '{options.Format}' format."); - } - } - - UpdateNetworkSiblingSetContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpdateNetworkSiblingSetContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UpdateNetworkSiblingSetContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetRequest.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetRequest.Serialization.cs new file mode 100644 index 000000000000..6ef16bb88009 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetRequest.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Network sibling set update. + public partial class UpdateNetworkSiblingSetRequest : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal UpdateNetworkSiblingSetRequest() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateNetworkSiblingSetRequest)} does not support writing '{format}' format."); + } + writer.WritePropertyName("networkSiblingSetId"u8); + writer.WriteStringValue(NetworkSiblingSetId); + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + writer.WritePropertyName("networkSiblingSetStateId"u8); + writer.WriteStringValue(NetworkSiblingSetStateId); + writer.WritePropertyName("networkFeatures"u8); + writer.WriteStringValue(NetworkFeatures.ToString()); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + UpdateNetworkSiblingSetRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UpdateNetworkSiblingSetRequest JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateNetworkSiblingSetRequest)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateNetworkSiblingSetRequest(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UpdateNetworkSiblingSetRequest DeserializeUpdateNetworkSiblingSetRequest(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string networkSiblingSetId = default; + ResourceIdentifier subnetId = default; + string networkSiblingSetStateId = default; + NetworkFeatures networkFeatures = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("networkSiblingSetId"u8)) + { + networkSiblingSetId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("subnetId"u8)) + { + subnetId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("networkSiblingSetStateId"u8)) + { + networkSiblingSetStateId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("networkFeatures"u8)) + { + networkFeatures = new NetworkFeatures(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new UpdateNetworkSiblingSetRequest(networkSiblingSetId, subnetId, networkSiblingSetStateId, networkFeatures, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(UpdateNetworkSiblingSetRequest)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + UpdateNetworkSiblingSetRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UpdateNetworkSiblingSetRequest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeUpdateNetworkSiblingSetRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateNetworkSiblingSetRequest)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(UpdateNetworkSiblingSetRequest updateNetworkSiblingSetRequest) + { + if (updateNetworkSiblingSetRequest == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(updateNetworkSiblingSetRequest, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetContent.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetRequest.cs similarity index 61% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetContent.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetRequest.cs index f57744de1d4c..1eeb3604a110 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetContent.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UpdateNetworkSiblingSetRequest.cs @@ -8,51 +8,23 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Network sibling set update. - public partial class UpdateNetworkSiblingSetContent + public partial class UpdateNetworkSiblingSetRequest { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. /// Network sibling set state Id identifying the current state of the sibling set. /// Network features available to the volume. /// , or is null. - public UpdateNetworkSiblingSetContent(string networkSiblingSetId, ResourceIdentifier subnetId, string networkSiblingSetStateId, NetAppNetworkFeature networkFeatures) + public UpdateNetworkSiblingSetRequest(string networkSiblingSetId, ResourceIdentifier subnetId, string networkSiblingSetStateId, NetworkFeatures networkFeatures) { Argument.AssertNotNull(networkSiblingSetId, nameof(networkSiblingSetId)); Argument.AssertNotNull(subnetId, nameof(subnetId)); @@ -64,33 +36,31 @@ public UpdateNetworkSiblingSetContent(string networkSiblingSetId, ResourceIdenti NetworkFeatures = networkFeatures; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. /// Network sibling set state Id identifying the current state of the sibling set. /// Network features available to the volume. - /// Keeps track of any properties unknown to the library. - internal UpdateNetworkSiblingSetContent(string networkSiblingSetId, ResourceIdentifier subnetId, string networkSiblingSetStateId, NetAppNetworkFeature networkFeatures, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal UpdateNetworkSiblingSetRequest(string networkSiblingSetId, ResourceIdentifier subnetId, string networkSiblingSetStateId, NetworkFeatures networkFeatures, IDictionary additionalBinaryDataProperties) { NetworkSiblingSetId = networkSiblingSetId; SubnetId = subnetId; NetworkSiblingSetStateId = networkSiblingSetStateId; NetworkFeatures = networkFeatures; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal UpdateNetworkSiblingSetContent() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. public string NetworkSiblingSetId { get; } + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. Example /subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/{mySubnet}. public ResourceIdentifier SubnetId { get; } + /// Network sibling set state Id identifying the current state of the sibling set. public string NetworkSiblingSetStateId { get; } + /// Network features available to the volume. - public NetAppNetworkFeature NetworkFeatures { get; } + public NetworkFeatures NetworkFeatures { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageName.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageName.Serialization.cs new file mode 100644 index 000000000000..2b5539443c7a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageName.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The name of the usage. + public partial class UsageName : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UsageName)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + UsageName IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UsageName JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UsageName)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUsageName(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UsageName DeserializeUsageName(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + string localizedValue = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + value = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("localizedValue"u8)) + { + localizedValue = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new UsageName(value, localizedValue, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(UsageName)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + UsageName IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UsageName PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeUsageName(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UsageName)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageName.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageName.cs new file mode 100644 index 000000000000..b437df079282 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageName.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// The name of the usage. + public partial class UsageName + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal UsageName() + { + } + + /// Initializes a new instance of . + /// The name of the usage. + /// The localized name of the usage. + /// Keeps track of any properties unknown to the library. + internal UsageName(string value, string localizedValue, IDictionary additionalBinaryDataProperties) + { + Value = value; + LocalizedValue = localizedValue; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The name of the usage. + public string Value { get; } + + /// The localized name of the usage. + public string LocalizedValue { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageProperties.Serialization.cs new file mode 100644 index 000000000000..5071b14ade1d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageProperties.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Usage properties. + internal partial class UsageProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UsageProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(CurrentValue)) + { + writer.WritePropertyName("currentValue"u8); + writer.WriteNumberValue(CurrentValue.Value); + } + if (options.Format != "W" && Optional.IsDefined(Limit)) + { + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit.Value); + } + if (options.Format != "W" && Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + UsageProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UsageProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UsageProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUsageProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UsageProperties DeserializeUsageProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? currentValue = default; + int? limit = default; + string unit = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("currentValue"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + currentValue = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("limit"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + limit = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("unit"u8)) + { + unit = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new UsageProperties(currentValue, limit, unit, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(UsageProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + UsageProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UsageProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeUsageProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UsageProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageProperties.cs new file mode 100644 index 000000000000..7ea9cf473edb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageProperties.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Usage properties. + internal partial class UsageProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal UsageProperties() + { + } + + /// Initializes a new instance of . + /// The current usage value for the subscription. + /// The limit of the usage. + /// The unit of the usage. + /// Keeps track of any properties unknown to the library. + internal UsageProperties(int? currentValue, int? limit, string unit, IDictionary additionalBinaryDataProperties) + { + CurrentValue = currentValue; + Limit = limit; + Unit = unit; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The current usage value for the subscription. + public int? CurrentValue { get; } + + /// The limit of the usage. + public int? Limit { get; } + + /// The unit of the usage. + public string Unit { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageResult.Serialization.cs new file mode 100644 index 000000000000..12d2f3cd4802 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageResult.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Usages entity model. + public partial class UsageResult : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UsageResult)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteObjectValue(Name, options); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + UsageResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UsageResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UsageResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUsageResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UsageResult DeserializeUsageResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + UsageName name = default; + UsageProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("name"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = UsageName.DeserializeUsageName(prop.Value, options); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = UsageProperties.DeserializeUsageProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new UsageResult(id, name, properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(UsageResult)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + UsageResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UsageResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeUsageResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UsageResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static UsageResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeUsageResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageResult.cs new file mode 100644 index 000000000000..f6a3d8392378 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsageResult.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Usages entity model. + public partial class UsageResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal UsageResult() + { + } + + /// Initializes a new instance of . + /// The id of the usage. + /// The name of the usage. + /// Usage properties. + /// Keeps track of any properties unknown to the library. + internal UsageResult(string id, UsageName name, UsageProperties properties, IDictionary additionalBinaryDataProperties) + { + Id = id; + Name = name; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The id of the usage. + public string Id { get; } + + /// The name of the usage. + public UsageName Name { get; } + + /// Usage properties. + internal UsageProperties Properties { get; } + + /// The current usage value for the subscription. + public int? CurrentValue + { + get + { + return Properties.CurrentValue; + } + } + + /// The limit of the usage. + public int? Limit + { + get + { + return Properties.Limit; + } + } + + /// The unit of the usage. + public string Unit + { + get + { + return Properties.Unit; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsagesListResult.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsagesListResult.Serialization.cs index 1b5ccd873ccf..718f036e128a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsagesListResult.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsagesListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class UsagesListResult : IUtf8JsonSerializable, IJsonModel + /// Usages result. + internal partial class UsagesListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal UsagesListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(UsagesListResult)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (UsageResult item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UsagesListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + UsagesListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UsagesListResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(UsagesListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeUsagesListResult(document.RootElement, options); } - internal static UsagesListResult DeserializeUsagesListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UsagesListResult DeserializeUsagesListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(NetAppUsageResult.DeserializeNetAppUsageResult(item, options)); + array.Add(UsageResult.DeserializeUsageResult(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new UsagesListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new UsagesListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -133,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op } } - UsagesListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + UsagesListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UsagesListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeUsagesListResult(document.RootElement, options); } default: @@ -149,6 +163,15 @@ UsagesListResult IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static UsagesListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeUsagesListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsagesListResult.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsagesListResult.cs index c5cdf62cff59..6588e4b2aac9 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsagesListResult.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/UsagesListResult.cs @@ -7,64 +7,38 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.NetApp.Models { /// Usages result. internal partial class UsagesListResult { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal UsagesListResult() + /// The UsageResult items on this page. + internal UsagesListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// A list of usages. - /// URL to get the next set of results. - /// Keeps track of any properties unknown to the library. - internal UsagesListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The UsageResult items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal UsagesListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// A list of usages. - public IReadOnlyList Value { get; } - /// URL to get the next set of results. - public string NextLink { get; } + /// The UsageResult items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupProperties.Serialization.cs new file mode 100644 index 000000000000..d0a37a53e8ae --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupProperties.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume Backup Properties. + public partial class VolumeBackupProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeBackupProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(BackupPolicyId)) + { + writer.WritePropertyName("backupPolicyId"u8); + writer.WriteStringValue(BackupPolicyId); + } + if (Optional.IsDefined(PolicyEnforced)) + { + writer.WritePropertyName("policyEnforced"u8); + writer.WriteBooleanValue(PolicyEnforced.Value); + } + if (Optional.IsDefined(BackupVaultId)) + { + writer.WritePropertyName("backupVaultId"u8); + writer.WriteStringValue(BackupVaultId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeBackupProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeBackupProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeBackupProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeBackupProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeBackupProperties DeserializeVolumeBackupProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier backupPolicyId = default; + bool? policyEnforced = default; + ResourceIdentifier backupVaultId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("backupPolicyId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupPolicyId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("policyEnforced"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyEnforced = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("backupVaultId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupVaultId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeBackupProperties(backupPolicyId, policyEnforced, backupVaultId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeBackupProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeBackupProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeBackupProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeBackupProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeBackupProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupProperties.cs new file mode 100644 index 000000000000..d22ca23be4f7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupProperties.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume Backup Properties. + public partial class VolumeBackupProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumeBackupProperties() + { + } + + /// Initializes a new instance of . + /// Backup Policy Resource ID. + /// Policy Enforced. + /// Backup Vault Resource ID. + /// Keeps track of any properties unknown to the library. + internal VolumeBackupProperties(ResourceIdentifier backupPolicyId, bool? policyEnforced, ResourceIdentifier backupVaultId, IDictionary additionalBinaryDataProperties) + { + BackupPolicyId = backupPolicyId; + PolicyEnforced = policyEnforced; + BackupVaultId = backupVaultId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Backup Policy Resource ID. + public ResourceIdentifier BackupPolicyId { get; set; } + + /// Policy Enforced. + public bool? PolicyEnforced { get; set; } + + /// Backup Vault Resource ID. + public ResourceIdentifier BackupVaultId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupRelationshipStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupRelationshipStatus.cs new file mode 100644 index 000000000000..8074cb2a58f9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackupRelationshipStatus.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Status of the volume backup relationship. + public readonly partial struct VolumeBackupRelationshipStatus : IEquatable + { + private readonly string _value; + private const string IdleValue = "Idle"; + private const string TransferringValue = "Transferring"; + private const string FailedValue = "Failed"; + private const string UnknownValue = "Unknown"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public VolumeBackupRelationshipStatus(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Idle. + public static VolumeBackupRelationshipStatus Idle { get; } = new VolumeBackupRelationshipStatus(IdleValue); + + /// Gets the Transferring. + public static VolumeBackupRelationshipStatus Transferring { get; } = new VolumeBackupRelationshipStatus(TransferringValue); + + /// Gets the Failed. + public static VolumeBackupRelationshipStatus Failed { get; } = new VolumeBackupRelationshipStatus(FailedValue); + + /// Gets the Unknown. + public static VolumeBackupRelationshipStatus Unknown { get; } = new VolumeBackupRelationshipStatus(UnknownValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(VolumeBackupRelationshipStatus left, VolumeBackupRelationshipStatus right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(VolumeBackupRelationshipStatus left, VolumeBackupRelationshipStatus right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator VolumeBackupRelationshipStatus(string value) => new VolumeBackupRelationshipStatus(value); + + /// Converts a string to a . + /// The value. + public static implicit operator VolumeBackupRelationshipStatus?(string value) => value == null ? null : new VolumeBackupRelationshipStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VolumeBackupRelationshipStatus other && Equals(other); + + /// + public bool Equals(VolumeBackupRelationshipStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackups.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackups.Serialization.cs new file mode 100644 index 000000000000..f7d4c32b6493 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackups.Serialization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume details using the backup policy. + public partial class VolumeBackups : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeBackups)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(VolumeName)) + { + writer.WritePropertyName("volumeName"u8); + writer.WriteStringValue(VolumeName); + } + if (Optional.IsDefined(VolumeResourceId)) + { + writer.WritePropertyName("volumeResourceId"u8); + writer.WriteStringValue(VolumeResourceId); + } + if (Optional.IsDefined(BackupsCount)) + { + writer.WritePropertyName("backupsCount"u8); + writer.WriteNumberValue(BackupsCount.Value); + } + if (Optional.IsDefined(PolicyEnabled)) + { + writer.WritePropertyName("policyEnabled"u8); + writer.WriteBooleanValue(PolicyEnabled.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeBackups IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeBackups JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeBackups)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeBackups(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeBackups DeserializeVolumeBackups(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string volumeName = default; + ResourceIdentifier volumeResourceId = default; + int? backupsCount = default; + bool? policyEnabled = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("volumeName"u8)) + { + volumeName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("volumeResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + volumeResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("backupsCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backupsCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("policyEnabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyEnabled = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeBackups(volumeName, volumeResourceId, backupsCount, policyEnabled, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeBackups)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeBackups IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeBackups PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeBackups(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeBackups)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackups.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackups.cs new file mode 100644 index 000000000000..3a41ab5bfa45 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeBackups.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume details using the backup policy. + public partial class VolumeBackups + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal VolumeBackups() + { + } + + /// Initializes a new instance of . + /// Volume name. + /// ResourceId used to identify the Volume. + /// Total count of backups for volume. + /// Policy enabled. + /// Keeps track of any properties unknown to the library. + internal VolumeBackups(string volumeName, ResourceIdentifier volumeResourceId, int? backupsCount, bool? policyEnabled, IDictionary additionalBinaryDataProperties) + { + VolumeName = volumeName; + VolumeResourceId = volumeResourceId; + BackupsCount = backupsCount; + PolicyEnabled = policyEnabled; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Volume name. + public string VolumeName { get; } + + /// ResourceId used to identify the Volume. + public ResourceIdentifier VolumeResourceId { get; } + + /// Total count of backups for volume. + public int? BackupsCount { get; } + + /// Policy enabled. + public bool? PolicyEnabled { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroup.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroup.Serialization.cs new file mode 100644 index 000000000000..de6957ff3b2d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroup.Serialization.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume group resource. + public partial class VolumeGroup : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroup)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + } + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeGroup IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeGroup JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroup)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeGroup(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeGroup DeserializeVolumeGroup(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string location = default; + string id = default; + string name = default; + string @type = default; + VolumeGroupListProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("location"u8)) + { + location = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + @type = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = VolumeGroupListProperties.DeserializeVolumeGroupListProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeGroup( + location, + id, + name, + @type, + properties, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeGroup)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeGroup IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeGroup PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeGroup(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeGroup)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroup.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroup.cs new file mode 100644 index 000000000000..d795b74a8cce --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroup.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume group resource. + public partial class VolumeGroup + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal VolumeGroup() + { + } + + /// Initializes a new instance of . + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Volume group properties. + /// Keeps track of any properties unknown to the library. + internal VolumeGroup(string location, string id, string name, string @type, VolumeGroupListProperties properties, IDictionary additionalBinaryDataProperties) + { + Location = location; + Id = id; + Name = name; + Type = @type; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource location. + public string Location { get; } + + /// Resource Id. + public string Id { get; } + + /// Resource name. + public string Name { get; } + + /// Resource type. + public string Type { get; } + + /// Volume group properties. + internal VolumeGroupListProperties Properties { get; } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties.ProvisioningState; + } + } + + /// Volume group details. + public VolumeGroupMetaData GroupMetaData + { + get + { + return Properties.GroupMetaData; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupList.Serialization.cs index 2b73ffbd6f4b..db57a4dcb4f7 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class VolumeGroupList : IUtf8JsonSerializable, IJsonModel + /// List of volume group resources. + internal partial class VolumeGroupList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal VolumeGroupList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VolumeGroupList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (VolumeGroup item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VolumeGroupList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + VolumeGroupList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeGroupList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VolumeGroupList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeVolumeGroupList(document.RootElement, options); } - internal static VolumeGroupList DeserializeVolumeGroupList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeGroupList DeserializeVolumeGroupList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - continue; + array.Add(VolumeGroup.DeserializeVolumeGroup(item, options)); } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { - array.Add(NetAppVolumeGroupResult.DeserializeNetAppVolumeGroupResult(item, options)); + continue; } - value = array; + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new VolumeGroupList(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new VolumeGroupList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt } } - VolumeGroupList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + VolumeGroupList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeGroupList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeVolumeGroupList(document.RootElement, options); } default: @@ -138,6 +163,15 @@ VolumeGroupList IPersistableModel.Create(BinaryData data, Model } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static VolumeGroupList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeVolumeGroupList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupList.cs index 031f8d1bfc9f..45d1ec521c10 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupList.cs @@ -7,60 +7,38 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.NetApp.Models { /// List of volume group resources. internal partial class VolumeGroupList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal VolumeGroupList() + /// The VolumeGroup items on this page. + internal VolumeGroupList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// List of volume Groups. - /// Keeps track of any properties unknown to the library. - internal VolumeGroupList(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// The VolumeGroup items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal VolumeGroupList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// List of volume Groups. - public IReadOnlyList Value { get; } + /// The VolumeGroup items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupListProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupListProperties.Serialization.cs new file mode 100644 index 000000000000..68ad10a2b386 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupListProperties.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume group properties. + internal partial class VolumeGroupListProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroupListProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (Optional.IsDefined(GroupMetaData)) + { + writer.WritePropertyName("groupMetaData"u8); + writer.WriteObjectValue(GroupMetaData, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeGroupListProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeGroupListProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroupListProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeGroupListProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeGroupListProperties DeserializeVolumeGroupListProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string provisioningState = default; + VolumeGroupMetaData groupMetaData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("groupMetaData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupMetaData = VolumeGroupMetaData.DeserializeVolumeGroupMetaData(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeGroupListProperties(provisioningState, groupMetaData, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeGroupListProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeGroupListProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeGroupListProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeGroupListProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeGroupListProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupListProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupListProperties.cs new file mode 100644 index 000000000000..a0c3d53d8a7a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupListProperties.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume group properties. + internal partial class VolumeGroupListProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal VolumeGroupListProperties() + { + } + + /// Initializes a new instance of . + /// Azure lifecycle management. + /// Volume group details. + /// Keeps track of any properties unknown to the library. + internal VolumeGroupListProperties(string provisioningState, VolumeGroupMetaData groupMetaData, IDictionary additionalBinaryDataProperties) + { + ProvisioningState = provisioningState; + GroupMetaData = groupMetaData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + + /// Volume group details. + public VolumeGroupMetaData GroupMetaData { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupMetaData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupMetaData.Serialization.cs new file mode 100644 index 000000000000..993f2e7858c2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupMetaData.Serialization.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume group properties. + public partial class VolumeGroupMetaData : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroupMetaData)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(GroupDescription)) + { + writer.WritePropertyName("groupDescription"u8); + writer.WriteStringValue(GroupDescription); + } + if (Optional.IsDefined(ApplicationType)) + { + writer.WritePropertyName("applicationType"u8); + writer.WriteStringValue(ApplicationType.Value.ToString()); + } + if (Optional.IsDefined(ApplicationIdentifier)) + { + writer.WritePropertyName("applicationIdentifier"u8); + writer.WriteStringValue(ApplicationIdentifier); + } + if (Optional.IsCollectionDefined(GlobalPlacementRules)) + { + writer.WritePropertyName("globalPlacementRules"u8); + writer.WriteStartArray(); + foreach (NetAppVolumePlacementRule item in GlobalPlacementRules) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(VolumesCount)) + { + writer.WritePropertyName("volumesCount"u8); + writer.WriteNumberValue(VolumesCount.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeGroupMetaData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeGroupMetaData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroupMetaData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeGroupMetaData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeGroupMetaData DeserializeVolumeGroupMetaData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string groupDescription = default; + NetAppApplicationType? applicationType = default; + string applicationIdentifier = default; + IList globalPlacementRules = default; + long? volumesCount = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("groupDescription"u8)) + { + groupDescription = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("applicationType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicationType = new NetAppApplicationType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("applicationIdentifier"u8)) + { + applicationIdentifier = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("globalPlacementRules"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(NetAppVolumePlacementRule.DeserializeNetAppVolumePlacementRule(item, options)); + } + globalPlacementRules = array; + continue; + } + if (prop.NameEquals("volumesCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + volumesCount = prop.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeGroupMetaData( + groupDescription, + applicationType, + applicationIdentifier, + globalPlacementRules ?? new ChangeTrackingList(), + volumesCount, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeGroupMetaData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeGroupMetaData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeGroupMetaData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeGroupMetaData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeGroupMetaData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupMetaData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupMetaData.cs new file mode 100644 index 000000000000..89e4b1d8f48c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupMetaData.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume group properties. + public partial class VolumeGroupMetaData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumeGroupMetaData() + { + GlobalPlacementRules = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Group Description. + /// Application Type. + /// Application specific identifier. + /// Application specific placement rules for the volume group. + /// Number of volumes in volume group. + /// Keeps track of any properties unknown to the library. + internal VolumeGroupMetaData(string groupDescription, NetAppApplicationType? applicationType, string applicationIdentifier, IList globalPlacementRules, long? volumesCount, IDictionary additionalBinaryDataProperties) + { + GroupDescription = groupDescription; + ApplicationType = applicationType; + ApplicationIdentifier = applicationIdentifier; + GlobalPlacementRules = globalPlacementRules; + VolumesCount = volumesCount; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Group Description. + public string GroupDescription { get; set; } + + /// Application Type. + public NetAppApplicationType? ApplicationType { get; set; } + + /// Application specific identifier. + public string ApplicationIdentifier { get; set; } + + /// Application specific placement rules for the volume group. + public IList GlobalPlacementRules { get; } + + /// Number of volumes in volume group. + public long? VolumesCount { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupProperties.Serialization.cs new file mode 100644 index 000000000000..5409d41bfaf5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupProperties.Serialization.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume group properties. + internal partial class VolumeGroupProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroupProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (Optional.IsDefined(GroupMetaData)) + { + writer.WritePropertyName("groupMetaData"u8); + writer.WriteObjectValue(GroupMetaData, options); + } + if (Optional.IsCollectionDefined(Volumes)) + { + writer.WritePropertyName("volumes"u8); + writer.WriteStartArray(); + foreach (VolumeGroupVolumeProperties item in Volumes) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeGroupProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeGroupProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroupProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeGroupProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeGroupProperties DeserializeVolumeGroupProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string provisioningState = default; + VolumeGroupMetaData groupMetaData = default; + IList volumes = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("groupMetaData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + groupMetaData = VolumeGroupMetaData.DeserializeVolumeGroupMetaData(prop.Value, options); + continue; + } + if (prop.NameEquals("volumes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(VolumeGroupVolumeProperties.DeserializeVolumeGroupVolumeProperties(item, options)); + } + volumes = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeGroupProperties(provisioningState, groupMetaData, volumes ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeGroupProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeGroupProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeGroupProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeGroupProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeGroupProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupProperties.cs new file mode 100644 index 000000000000..b34c1fa2f536 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupProperties.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume group properties. + internal partial class VolumeGroupProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumeGroupProperties() + { + Volumes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Azure lifecycle management. + /// Volume group details. + /// List of volumes from group. + /// Keeps track of any properties unknown to the library. + internal VolumeGroupProperties(string provisioningState, VolumeGroupMetaData groupMetaData, IList volumes, IDictionary additionalBinaryDataProperties) + { + ProvisioningState = provisioningState; + GroupMetaData = groupMetaData; + Volumes = volumes; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Azure lifecycle management. + public string ProvisioningState { get; } + + /// Volume group details. + public VolumeGroupMetaData GroupMetaData { get; set; } + + /// List of volumes from group. + public IList Volumes { get; } = new ChangeTrackingList(); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.Serialization.cs new file mode 100644 index 000000000000..20b075366214 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.Serialization.cs @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume resource. + public partial class VolumeGroupVolumeProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal VolumeGroupVolumeProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroupVolumeProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (string item in Zones) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeGroupVolumeProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeGroupVolumeProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroupVolumeProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeGroupVolumeProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeGroupVolumeProperties DeserializeVolumeGroupVolumeProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string name = default; + string @type = default; + IDictionary tags = default; + IList zones = default; + VolumeProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + @type = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("zones"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + zones = array; + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = VolumeProperties.DeserializeVolumeProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeGroupVolumeProperties( + id, + name, + @type, + tags ?? new ChangeTrackingDictionary(), + zones ?? new ChangeTrackingList(), + properties, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeGroupVolumeProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeGroupVolumeProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeGroupVolumeProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeGroupVolumeProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeGroupVolumeProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.cs new file mode 100644 index 000000000000..6d820758bd20 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeGroupVolumeProperties.cs @@ -0,0 +1,990 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume resource. + public partial class VolumeGroupVolumeProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// A unique file path for the volume. Used when creating mount targets. + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. + /// or is null. + public VolumeGroupVolumeProperties(string creationToken, long usageThreshold, string subnetId) + { + Argument.AssertNotNull(creationToken, nameof(creationToken)); + Argument.AssertNotNull(subnetId, nameof(subnetId)); + + Tags = new ChangeTrackingDictionary(); + Zones = new ChangeTrackingList(); + CreationToken = creationToken; + UsageThreshold = usageThreshold; + SubnetId = subnetId; + } + + /// Initializes a new instance of . + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// Availability Zone. + /// Volume properties. + /// Keeps track of any properties unknown to the library. + internal VolumeGroupVolumeProperties(string id, string name, string @type, IDictionary tags, IList zones, VolumeProperties properties, IDictionary additionalBinaryDataProperties) + { + Id = id; + Name = name; + Type = @type; + Tags = tags; + Zones = zones; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource Id. + public string Id { get; } + + /// Resource name. + public string Name { get; set; } + + /// Resource type. + public string Type { get; } + + /// Resource tags. + public IDictionary Tags { get; } + + /// Availability Zone. + public IList Zones { get; } + + /// Volume properties. + internal VolumeProperties Properties { get; set; } + + /// Unique FileSystem Identifier. + public string FileSystemId + { + get + { + return Properties is null ? default : Properties.FileSystemId; + } + } + + /// A unique file path for the volume. Used when creating mount targets. + public string CreationToken + { + get + { + return Properties is null ? default : Properties.CreationToken; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CreationToken = value; + } + } + + /// The service level of the file system. + public NetAppFileServiceLevel? ServiceLevel + { + get + { + return Properties is null ? default : Properties.ServiceLevel; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.ServiceLevel = value.Value; + } + } + + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// + public long UsageThreshold + { + get + { + return Properties is null ? default : Properties.UsageThreshold; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.UsageThreshold = value; + } + } + + /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + public IList ProtocolTypes + { + get + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + return Properties.ProtocolTypes; + } + } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Resource identifier used to identify the Snapshot. + public ResourceIdentifier SnapshotId + { + get + { + return Properties is null ? default : Properties.SnapshotId; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SnapshotId = value; + } + } + + /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. + public bool? DeleteBaseSnapshot + { + get + { + return Properties is null ? default : Properties.DeleteBaseSnapshot; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.DeleteBaseSnapshot = value.Value; + } + } + + /// Resource identifier used to identify the Backup. + public ResourceIdentifier BackupId + { + get + { + return Properties is null ? default : Properties.BackupId; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.BackupId = value; + } + } + + /// Unique Baremetal Tenant Identifier. + public string BaremetalTenantId + { + get + { + return Properties is null ? default : Properties.BaremetalTenantId; + } + } + + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. + public string SubnetId + { + get + { + return Properties is null ? default : Properties.SubnetId; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SubnetId = value; + } + } + + /// The original value of the network features type available to the volume at the time it was created. + public NetworkFeatures? NetworkFeatures + { + get + { + return Properties is null ? default : Properties.NetworkFeatures; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.NetworkFeatures = value.Value; + } + } + + /// The effective value of the network features type available to the volume, or current effective state of update. + public NetworkFeatures? EffectiveNetworkFeatures + { + get + { + return Properties is null ? default : Properties.EffectiveNetworkFeatures; + } + } + + /// Network Sibling Set ID for the the group of volumes sharing networking resources. + public string NetworkSiblingSetId + { + get + { + return Properties is null ? default : Properties.NetworkSiblingSetId; + } + } + + /// Provides storage to network proximity information for the volume. + public VolumeStorageToNetworkProximity? StorageToNetworkProximity + { + get + { + return Properties is null ? default : Properties.StorageToNetworkProximity; + } + } + + /// List of mount targets. + public IReadOnlyList MountTargets + { + get + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + return Properties.MountTargets; + } + } + + /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. For creating clone volume, set type to ShortTermClone. + public string VolumeType + { + get + { + return Properties is null ? default : Properties.VolumeType; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.VolumeType = value; + } + } + + /// DataProtection type volumes include an object containing details of the replication. + public VolumePropertiesDataProtection DataProtection + { + get + { + return Properties is null ? default : Properties.DataProtection; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.DataProtection = value; + } + } + + /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. + public AcceptGrowCapacityPoolForShortTermCloneSplit? AcceptGrowCapacityPoolForShortTermCloneSplit + { + get + { + return Properties is null ? default : Properties.AcceptGrowCapacityPoolForShortTermCloneSplit; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.AcceptGrowCapacityPoolForShortTermCloneSplit = value.Value; + } + } + + /// Restoring. + public bool? IsRestoring + { + get + { + return Properties is null ? default : Properties.IsRestoring; + } + } + + /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). + public bool? SnapshotDirectoryVisible + { + get + { + return Properties is null ? default : Properties.SnapshotDirectoryVisible; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SnapshotDirectoryVisible = value.Value; + } + } + + /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. + public bool? KerberosEnabled + { + get + { + return Properties is null ? default : Properties.KerberosEnabled; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.KerberosEnabled = value.Value; + } + } + + /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. + public SecurityStyle? SecurityStyle + { + get + { + return Properties is null ? default : Properties.SecurityStyle; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SecurityStyle = value.Value; + } + } + + /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. + public bool? SmbEncryption + { + get + { + return Properties is null ? default : Properties.SmbEncryption; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SmbEncryption = value.Value; + } + } + + /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. + public SmbAccessBasedEnumeration? SmbAccessBasedEnumeration + { + get + { + return Properties is null ? default : Properties.SmbAccessBasedEnumeration; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SmbAccessBasedEnumeration = value.Value; + } + } + + /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. + public SmbNonBrowsable? SmbNonBrowsable + { + get + { + return Properties is null ? default : Properties.SmbNonBrowsable; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SmbNonBrowsable = value.Value; + } + } + + /// Enables continuously available share property for smb volume. Only applicable for SMB volume. + public bool? SmbContinuouslyAvailable + { + get + { + return Properties is null ? default : Properties.SmbContinuouslyAvailable; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SmbContinuouslyAvailable = value.Value; + } + } + + /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. + public float? ThroughputMibps + { + get + { + return Properties is null ? default : Properties.ThroughputMibps; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.ThroughputMibps = value.Value; + } + } + + /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. + public float? ActualThroughputMibps + { + get + { + return Properties is null ? default : Properties.ActualThroughputMibps; + } + } + + /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. + public EncryptionKeySource? EncryptionKeySource + { + get + { + return Properties is null ? default : Properties.EncryptionKeySource; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.EncryptionKeySource = value.Value; + } + } + + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. + public string KeyVaultPrivateEndpointResourceId + { + get + { + return Properties is null ? default : Properties.KeyVaultPrivateEndpointResourceId; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.KeyVaultPrivateEndpointResourceId = value; + } + } + + /// Specifies whether LDAP is enabled or not for a given NFS volume. + public bool? LdapEnabled + { + get + { + return Properties is null ? default : Properties.LdapEnabled; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.LdapEnabled = value.Value; + } + } + + /// Specifies the type of LDAP server for a given NFS volume. + public LdapServerType? LdapServerType + { + get + { + return Properties is null ? default : Properties.LdapServerType; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.LdapServerType = value.Value; + } + } + + /// Specifies whether Cool Access(tiering) is enabled for the volume. + public bool? CoolAccess + { + get + { + return Properties is null ? default : Properties.CoolAccess; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CoolAccess = value.Value; + } + } + + /// Specifies the number of days after which data that is not accessed by clients will be tiered. + public int? CoolnessPeriod + { + get + { + return Properties is null ? default : Properties.CoolnessPeriod; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CoolnessPeriod = value.Value; + } + } + + /// + /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. + /// + public CoolAccessRetrievalPolicy? CoolAccessRetrievalPolicy + { + get + { + return Properties is null ? default : Properties.CoolAccessRetrievalPolicy; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CoolAccessRetrievalPolicy = value.Value; + } + } + + /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. + public CoolAccessTieringPolicy? CoolAccessTieringPolicy + { + get + { + return Properties is null ? default : Properties.CoolAccessTieringPolicy; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CoolAccessTieringPolicy = value.Value; + } + } + + /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. + public string UnixPermissions + { + get + { + return Properties is null ? default : Properties.UnixPermissions; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.UnixPermissions = value; + } + } + + /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. + public int? CloneProgress + { + get + { + return Properties is null ? default : Properties.CloneProgress; + } + } + + /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. + public FileAccessLogs? FileAccessLogs + { + get + { + return Properties is null ? default : Properties.FileAccessLogs; + } + } + + /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. + public AvsDataStore? AvsDataStore + { + get + { + return Properties is null ? default : Properties.AvsDataStore; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.AvsDataStore = value.Value; + } + } + + /// Data store resource unique identifier. + public IReadOnlyList DataStoreResourceId + { + get + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + return Properties.DataStoreResourceId; + } + } + + /// Specifies if default quota is enabled for the volume. + public bool? IsDefaultQuotaEnabled + { + get + { + return Properties is null ? default : Properties.IsDefaultQuotaEnabled; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.IsDefaultQuotaEnabled = value.Value; + } + } + + /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . + public long? DefaultUserQuotaInKiBs + { + get + { + return Properties is null ? default : Properties.DefaultUserQuotaInKiBs; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.DefaultUserQuotaInKiBs = value.Value; + } + } + + /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. + public long? DefaultGroupQuotaInKiBs + { + get + { + return Properties is null ? default : Properties.DefaultGroupQuotaInKiBs; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.DefaultGroupQuotaInKiBs = value.Value; + } + } + + /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. + public long? MaximumNumberOfFiles + { + get + { + return Properties is null ? default : Properties.MaximumNumberOfFiles; + } + } + + /// Volume Group Name. + public string VolumeGroupName + { + get + { + return Properties is null ? default : Properties.VolumeGroupName; + } + } + + /// Pool Resource Id used in case of creating a volume through volume group. + public string CapacityPoolResourceId + { + get + { + return Properties is null ? default : Properties.CapacityPoolResourceId; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CapacityPoolResourceId = value; + } + } + + /// Proximity placement group associated with the volume. + public string ProximityPlacementGroup + { + get + { + return Properties is null ? default : Properties.ProximityPlacementGroup; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.ProximityPlacementGroup = value; + } + } + + /// T2 network information. + public string T2Network + { + get + { + return Properties is null ? default : Properties.T2Network; + } + } + + /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. + public string VolumeSpecName + { + get + { + return Properties is null ? default : Properties.VolumeSpecName; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.VolumeSpecName = value; + } + } + + /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. + public bool? Encrypted + { + get + { + return Properties is null ? default : Properties.Encrypted; + } + } + + /// Application specific placement rules for the particular volume. + public IList PlacementRules + { + get + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + return Properties.PlacementRules; + } + } + + /// Flag indicating whether subvolume operations are enabled on the volume. + public EnableSubvolumes? EnableSubvolumes + { + get + { + return Properties is null ? default : Properties.EnableSubvolumes; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.EnableSubvolumes = value.Value; + } + } + + /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. + public string ProvisionedAvailabilityZone + { + get + { + return Properties is null ? default : Properties.ProvisionedAvailabilityZone; + } + } + + /// Specifies whether volume is a Large Volume or Regular Volume. + public bool? IsLargeVolume + { + get + { + return Properties is null ? default : Properties.IsLargeVolume; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.IsLargeVolume = value.Value; + } + } + + /// + /// Specifies the type of the Large Volume. When set to 'LargeVolume', the large volume is created with standard configuration. + /// If it is set to 'ExtraLargeVolume7Dot2PiB', the extra large volume is created with higher capacity limit 7.2PiB with cool access enabled, + /// delivering higher capacity limit with lower costs. + /// + public LargeVolumeType? LargeVolumeType + { + get + { + return Properties is null ? default : Properties.LargeVolumeType; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.LargeVolumeType = value.Value; + } + } + + /// Id of the snapshot or backup that the volume is restored from. + public string OriginatingResourceId + { + get + { + return Properties is null ? default : Properties.OriginatingResourceId; + } + } + + /// Space shared by short term clone volume with parent volume in bytes. + public long? InheritedSizeInBytes + { + get + { + return Properties is null ? default : Properties.InheritedSizeInBytes; + } + } + + /// Language supported for volume. + public VolumeLanguage? Language + { + get + { + return Properties is null ? default : Properties.Language; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.Language = value.Value; + } + } + + /// Specifies whether the volume operates in Breakthrough Mode. + public BreakthroughMode? BreakthroughMode + { + get + { + return Properties is null ? default : Properties.BreakthroughMode; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.BreakthroughMode = value.Value; + } + } + + /// Export policy rule. + public IList ExportRules + { + get + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + return Properties.ExportRules; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeLanguage.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeLanguage.cs new file mode 100644 index 000000000000..62d6f54c3ffc --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeLanguage.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Language supported for volume. + public readonly partial struct VolumeLanguage : IEquatable + { + private readonly string _value; + /// Posix with UTF-8. + private const string CUtf8Value = "c.utf-8"; + /// UTF-8 with 4 byte character support. + private const string Utf8mb4Value = "utf8mb4"; + /// Arabic - Deprecated. + private const string ArValue = "ar"; + /// Arabic with UTF-8. + private const string ArUtf8Value = "ar.utf-8"; + /// Croatian - Deprecated. + private const string HrValue = "hr"; + /// Croatian with UTF-8. + private const string HrUtf8Value = "hr.utf-8"; + /// Czech - Deprecated. + private const string CsValue = "cs"; + /// Czech with UTF-8. + private const string CsUtf8Value = "cs.utf-8"; + /// Danish - Deprecated. + private const string DaValue = "da"; + /// Danish with UTF-8. + private const string DaUtf8Value = "da.utf-8"; + /// Dutch - Deprecated. + private const string NlValue = "nl"; + /// Dutch with UTF-8. + private const string NlUtf8Value = "nl.utf-8"; + /// English - Deprecated. + private const string EnValue = "en"; + /// English with UTF-8. + private const string EnUtf8Value = "en.utf-8"; + /// Finnish - Deprecated. + private const string FiValue = "fi"; + /// Finnish with UTF-8. + private const string FiUtf8Value = "fi.utf-8"; + /// French - Deprecated. + private const string FrValue = "fr"; + /// French with UTF-8. + private const string FrUtf8Value = "fr.utf-8"; + /// German - Deprecated. + private const string DeValue = "de"; + /// German with UTF-8. + private const string DeUtf8Value = "de.utf-8"; + /// Hebrew - Deprecated. + private const string HeValue = "he"; + /// Hebrew with UTF-8. + private const string HeUtf8Value = "he.utf-8"; + /// Hungarian - Deprecated. + private const string HuValue = "hu"; + /// Hungarian with UTF-8. + private const string HuUtf8Value = "hu.utf-8"; + /// Italian - Deprecated. + private const string ItValue = "it"; + /// Italian with UTF-8. + private const string ItUtf8Value = "it.utf-8"; + /// Japanese euc-j - Deprecated. + private const string JaValue = "ja"; + /// Japanese euc-j with UTF-8. + private const string JaUtf8Value = "ja.utf-8"; + /// Japanese euc-j - Deprecated. + private const string JaV1Value = "ja-v1"; + /// Japanese euc-j with UTF-8. + private const string JaV1Utf8Value = "ja-v1.utf-8"; + /// Japanese pck. + private const string JaJpPckValue = "ja-jp.pck"; + /// Japanese pck with UTF-8 - Deprecated. + private const string JaJpPckUtf8Value = "ja-jp.pck.utf-8"; + /// Japanese cp932. + private const string JaJp932Value = "ja-jp.932"; + /// Japanese cp932 with UTF-8 - Deprecated. + private const string JaJp932Utf8Value = "ja-jp.932.utf-8"; + /// Japanese pck - sjis. + private const string JaJpPckV2Value = "ja-jp.pck-v2"; + /// Japanese pck - sjis with UTF-8 - Deprecated. + private const string JaJpPckV2Utf8Value = "ja-jp.pck-v2.utf-8"; + /// Korean - Deprecated. + private const string KoValue = "ko"; + /// Korean with UTF-8. + private const string KoUtf8Value = "ko.utf-8"; + /// Norwegian - Deprecated. + private const string NoValue = "no"; + /// Norwegian with UTF-8. + private const string NoUtf8Value = "no.utf-8"; + /// Polish - Deprecated. + private const string PlValue = "pl"; + /// Polish with UTF-8. + private const string PlUtf8Value = "pl.utf-8"; + /// Portuguese - Deprecated. + private const string PtValue = "pt"; + /// Portuguese with UTF-8. + private const string PtUtf8Value = "pt.utf-8"; + /// Posix - Deprecated. + private const string CValue = "c"; + /// Romanian - Deprecated. + private const string RoValue = "ro"; + /// Romanian with UTF-8. + private const string RoUtf8Value = "ro.utf-8"; + /// Russian - Deprecated. + private const string RuValue = "ru"; + /// Russian with UTF-8. + private const string RuUtf8Value = "ru.utf-8"; + /// Simplified Chinese - Deprecated. + private const string ZhValue = "zh"; + /// Simplified Chinese with UTF-8. + private const string ZhUtf8Value = "zh.utf-8"; + /// Simplified gbk Chinese. + private const string ZhGbkValue = "zh.gbk"; + /// Simplified gbk Chinese with UTF-8 - Deprecated. + private const string ZhGbkUtf8Value = "zh.gbk.utf-8"; + /// Traditional Chinese BIG 5. + private const string ZhTwBig5Value = "zh-tw.big5"; + /// Traditional Chinese BIG 5 with UTF-8 - Deprecated. + private const string ZhTwBig5Utf8Value = "zh-tw.big5.utf-8"; + /// Traditional Chinese EUC-TW. + private const string ZhTwValue = "zh-tw"; + /// Traditional Chinese EUC-TW with UTF-8 - Deprecated. + private const string ZhTwUtf8Value = "zh-tw.utf-8"; + /// Slovak - Deprecated. + private const string SkValue = "sk"; + /// Slovak with UTF-8. + private const string SkUtf8Value = "sk.utf-8"; + /// Slovenian - Deprecated. + private const string SlValue = "sl"; + /// Slovenian with UTF-8. + private const string SlUtf8Value = "sl.utf-8"; + /// Spanish - Deprecated. + private const string EsValue = "es"; + /// Spanish with UTF-8. + private const string EsUtf8Value = "es.utf-8"; + /// Swedish - Deprecated. + private const string SvValue = "sv"; + /// Swedish with UTF-8. + private const string SvUtf8Value = "sv.utf-8"; + /// Turkish - Deprecated. + private const string TrValue = "tr"; + /// Turkish with UTF-8. + private const string TrUtf8Value = "tr.utf-8"; + /// US English - Deprecated. + private const string EnUsValue = "en-us"; + /// US English with UTF-8. + private const string EnUsUtf8Value = "en-us.utf-8"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public VolumeLanguage(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Posix with UTF-8. + public static VolumeLanguage CUtf8 { get; } = new VolumeLanguage(CUtf8Value); + + /// UTF-8 with 4 byte character support. + public static VolumeLanguage Utf8mb4 { get; } = new VolumeLanguage(Utf8mb4Value); + + /// Arabic - Deprecated. + public static VolumeLanguage Ar { get; } = new VolumeLanguage(ArValue); + + /// Arabic with UTF-8. + public static VolumeLanguage ArUtf8 { get; } = new VolumeLanguage(ArUtf8Value); + + /// Croatian - Deprecated. + public static VolumeLanguage Hr { get; } = new VolumeLanguage(HrValue); + + /// Croatian with UTF-8. + public static VolumeLanguage HrUtf8 { get; } = new VolumeLanguage(HrUtf8Value); + + /// Czech - Deprecated. + public static VolumeLanguage Cs { get; } = new VolumeLanguage(CsValue); + + /// Czech with UTF-8. + public static VolumeLanguage CsUtf8 { get; } = new VolumeLanguage(CsUtf8Value); + + /// Danish - Deprecated. + public static VolumeLanguage Da { get; } = new VolumeLanguage(DaValue); + + /// Danish with UTF-8. + public static VolumeLanguage DaUtf8 { get; } = new VolumeLanguage(DaUtf8Value); + + /// Dutch - Deprecated. + public static VolumeLanguage Nl { get; } = new VolumeLanguage(NlValue); + + /// Dutch with UTF-8. + public static VolumeLanguage NlUtf8 { get; } = new VolumeLanguage(NlUtf8Value); + + /// English - Deprecated. + public static VolumeLanguage En { get; } = new VolumeLanguage(EnValue); + + /// English with UTF-8. + public static VolumeLanguage EnUtf8 { get; } = new VolumeLanguage(EnUtf8Value); + + /// Finnish - Deprecated. + public static VolumeLanguage Fi { get; } = new VolumeLanguage(FiValue); + + /// Finnish with UTF-8. + public static VolumeLanguage FiUtf8 { get; } = new VolumeLanguage(FiUtf8Value); + + /// French - Deprecated. + public static VolumeLanguage Fr { get; } = new VolumeLanguage(FrValue); + + /// French with UTF-8. + public static VolumeLanguage FrUtf8 { get; } = new VolumeLanguage(FrUtf8Value); + + /// German - Deprecated. + public static VolumeLanguage De { get; } = new VolumeLanguage(DeValue); + + /// German with UTF-8. + public static VolumeLanguage DeUtf8 { get; } = new VolumeLanguage(DeUtf8Value); + + /// Hebrew - Deprecated. + public static VolumeLanguage He { get; } = new VolumeLanguage(HeValue); + + /// Hebrew with UTF-8. + public static VolumeLanguage HeUtf8 { get; } = new VolumeLanguage(HeUtf8Value); + + /// Hungarian - Deprecated. + public static VolumeLanguage Hu { get; } = new VolumeLanguage(HuValue); + + /// Hungarian with UTF-8. + public static VolumeLanguage HuUtf8 { get; } = new VolumeLanguage(HuUtf8Value); + + /// Italian - Deprecated. + public static VolumeLanguage It { get; } = new VolumeLanguage(ItValue); + + /// Italian with UTF-8. + public static VolumeLanguage ItUtf8 { get; } = new VolumeLanguage(ItUtf8Value); + + /// Japanese euc-j - Deprecated. + public static VolumeLanguage Ja { get; } = new VolumeLanguage(JaValue); + + /// Japanese euc-j with UTF-8. + public static VolumeLanguage JaUtf8 { get; } = new VolumeLanguage(JaUtf8Value); + + /// Japanese euc-j - Deprecated. + public static VolumeLanguage JaV1 { get; } = new VolumeLanguage(JaV1Value); + + /// Japanese euc-j with UTF-8. + public static VolumeLanguage JaV1Utf8 { get; } = new VolumeLanguage(JaV1Utf8Value); + + /// Japanese pck. + public static VolumeLanguage JaJpPck { get; } = new VolumeLanguage(JaJpPckValue); + + /// Japanese pck with UTF-8 - Deprecated. + public static VolumeLanguage JaJpPckUtf8 { get; } = new VolumeLanguage(JaJpPckUtf8Value); + + /// Japanese cp932. + public static VolumeLanguage JaJp932 { get; } = new VolumeLanguage(JaJp932Value); + + /// Japanese cp932 with UTF-8 - Deprecated. + public static VolumeLanguage JaJp932Utf8 { get; } = new VolumeLanguage(JaJp932Utf8Value); + + /// Japanese pck - sjis. + public static VolumeLanguage JaJpPckV2 { get; } = new VolumeLanguage(JaJpPckV2Value); + + /// Japanese pck - sjis with UTF-8 - Deprecated. + public static VolumeLanguage JaJpPckV2Utf8 { get; } = new VolumeLanguage(JaJpPckV2Utf8Value); + + /// Korean - Deprecated. + public static VolumeLanguage Ko { get; } = new VolumeLanguage(KoValue); + + /// Korean with UTF-8. + public static VolumeLanguage KoUtf8 { get; } = new VolumeLanguage(KoUtf8Value); + + /// Norwegian - Deprecated. + public static VolumeLanguage No { get; } = new VolumeLanguage(NoValue); + + /// Norwegian with UTF-8. + public static VolumeLanguage NoUtf8 { get; } = new VolumeLanguage(NoUtf8Value); + + /// Polish - Deprecated. + public static VolumeLanguage Pl { get; } = new VolumeLanguage(PlValue); + + /// Polish with UTF-8. + public static VolumeLanguage PlUtf8 { get; } = new VolumeLanguage(PlUtf8Value); + + /// Portuguese - Deprecated. + public static VolumeLanguage Pt { get; } = new VolumeLanguage(PtValue); + + /// Portuguese with UTF-8. + public static VolumeLanguage PtUtf8 { get; } = new VolumeLanguage(PtUtf8Value); + + /// Posix - Deprecated. + public static VolumeLanguage C { get; } = new VolumeLanguage(CValue); + + /// Romanian - Deprecated. + public static VolumeLanguage Ro { get; } = new VolumeLanguage(RoValue); + + /// Romanian with UTF-8. + public static VolumeLanguage RoUtf8 { get; } = new VolumeLanguage(RoUtf8Value); + + /// Russian - Deprecated. + public static VolumeLanguage Ru { get; } = new VolumeLanguage(RuValue); + + /// Russian with UTF-8. + public static VolumeLanguage RuUtf8 { get; } = new VolumeLanguage(RuUtf8Value); + + /// Simplified Chinese - Deprecated. + public static VolumeLanguage Zh { get; } = new VolumeLanguage(ZhValue); + + /// Simplified Chinese with UTF-8. + public static VolumeLanguage ZhUtf8 { get; } = new VolumeLanguage(ZhUtf8Value); + + /// Simplified gbk Chinese. + public static VolumeLanguage ZhGbk { get; } = new VolumeLanguage(ZhGbkValue); + + /// Simplified gbk Chinese with UTF-8 - Deprecated. + public static VolumeLanguage ZhGbkUtf8 { get; } = new VolumeLanguage(ZhGbkUtf8Value); + + /// Traditional Chinese BIG 5. + public static VolumeLanguage ZhTwBig5 { get; } = new VolumeLanguage(ZhTwBig5Value); + + /// Traditional Chinese BIG 5 with UTF-8 - Deprecated. + public static VolumeLanguage ZhTwBig5Utf8 { get; } = new VolumeLanguage(ZhTwBig5Utf8Value); + + /// Traditional Chinese EUC-TW. + public static VolumeLanguage ZhTw { get; } = new VolumeLanguage(ZhTwValue); + + /// Traditional Chinese EUC-TW with UTF-8 - Deprecated. + public static VolumeLanguage ZhTwUtf8 { get; } = new VolumeLanguage(ZhTwUtf8Value); + + /// Slovak - Deprecated. + public static VolumeLanguage Sk { get; } = new VolumeLanguage(SkValue); + + /// Slovak with UTF-8. + public static VolumeLanguage SkUtf8 { get; } = new VolumeLanguage(SkUtf8Value); + + /// Slovenian - Deprecated. + public static VolumeLanguage Sl { get; } = new VolumeLanguage(SlValue); + + /// Slovenian with UTF-8. + public static VolumeLanguage SlUtf8 { get; } = new VolumeLanguage(SlUtf8Value); + + /// Spanish - Deprecated. + public static VolumeLanguage Es { get; } = new VolumeLanguage(EsValue); + + /// Spanish with UTF-8. + public static VolumeLanguage EsUtf8 { get; } = new VolumeLanguage(EsUtf8Value); + + /// Swedish - Deprecated. + public static VolumeLanguage Sv { get; } = new VolumeLanguage(SvValue); + + /// Swedish with UTF-8. + public static VolumeLanguage SvUtf8 { get; } = new VolumeLanguage(SvUtf8Value); + + /// Turkish - Deprecated. + public static VolumeLanguage Tr { get; } = new VolumeLanguage(TrValue); + + /// Turkish with UTF-8. + public static VolumeLanguage TrUtf8 { get; } = new VolumeLanguage(TrUtf8Value); + + /// US English - Deprecated. + public static VolumeLanguage EnUs { get; } = new VolumeLanguage(EnUsValue); + + /// US English with UTF-8. + public static VolumeLanguage EnUsUtf8 { get; } = new VolumeLanguage(EnUsUtf8Value); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(VolumeLanguage left, VolumeLanguage right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(VolumeLanguage left, VolumeLanguage right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator VolumeLanguage(string value) => new VolumeLanguage(value); + + /// Converts a string to a . + /// The value. + public static implicit operator VolumeLanguage?(string value) => value == null ? null : new VolumeLanguage(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VolumeLanguage other && Equals(other); + + /// + public bool Equals(VolumeLanguage other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeList.Serialization.cs index f72101ed4a0d..4b9bd83214ef 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class VolumeList : IUtf8JsonSerializable, IJsonModel + /// List of volume resources. + internal partial class VolumeList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal VolumeList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VolumeList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (VolumeData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VolumeList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + VolumeList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VolumeList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeVolumeList(document.RootElement, options); } - internal static VolumeList DeserializeVolumeList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeList DeserializeVolumeList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(NetAppVolumeData.DeserializeNetAppVolumeData(item, options)); + array.Add(VolumeData.DeserializeVolumeData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new VolumeList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new VolumeList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -133,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - VolumeList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + VolumeList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeVolumeList(document.RootElement, options); } default: @@ -149,6 +163,15 @@ VolumeList IPersistableModel.Create(BinaryData data, ModelReaderWrit } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static VolumeList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeVolumeList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeList.cs index adcfb1676567..c2e318a3f651 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of volume resources. internal partial class VolumeList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal VolumeList() + /// The Volume items on this page. + internal VolumeList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// List of volumes. - /// URL to get the next set of results. - /// Keeps track of any properties unknown to the library. - internal VolumeList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The Volume items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal VolumeList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// List of volumes. - public IReadOnlyList Value { get; } - /// URL to get the next set of results. - public string NextLink { get; } + /// The Volume items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatch.Serialization.cs new file mode 100644 index 000000000000..1ec9e02a98bf --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatch.Serialization.cs @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume patch resource. + public partial class VolumePatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumePatch)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + } + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumePatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumePatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumePatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumePatch DeserializeVolumePatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string location = default; + string id = default; + string name = default; + string @type = default; + IDictionary tags = default; + VolumePatchProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("location"u8)) + { + location = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + @type = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = VolumePatchProperties.DeserializeVolumePatchProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumePatch( + location, + id, + name, + @type, + tags ?? new ChangeTrackingDictionary(), + properties, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumePatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumePatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumePatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(VolumePatch volumePatch) + { + if (volumePatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(volumePatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatch.cs new file mode 100644 index 000000000000..00fa2f924ff3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatch.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume patch resource. + public partial class VolumePatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource location. + /// Resource Id. + /// Resource name. + /// Resource type. + /// Resource tags. + /// Patchable volume properties. + /// Keeps track of any properties unknown to the library. + internal VolumePatch(string location, string id, string name, string @type, IDictionary tags, VolumePatchProperties properties, IDictionary additionalBinaryDataProperties) + { + Location = location; + Id = id; + Name = name; + Type = @type; + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource location. + public string Location { get; set; } + + /// Resource Id. + public string Id { get; } + + /// Resource name. + public string Name { get; } + + /// Resource type. + public string Type { get; } + + /// Resource tags. + public IDictionary Tags { get; } + + /// Patchable volume properties. + internal VolumePatchProperties Properties { get; set; } + + /// The service level of the file system. + public NetAppFileServiceLevel? ServiceLevel + { + get + { + return Properties is null ? default : Properties.ServiceLevel; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.ServiceLevel = value.Value; + } + } + + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// + public long? UsageThreshold + { + get + { + return Properties is null ? default : Properties.UsageThreshold; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.UsageThreshold = value.Value; + } + } + + /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + public IList ProtocolTypes + { + get + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + return Properties.ProtocolTypes; + } + } + + /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. + public float? ThroughputMibps + { + get + { + return Properties is null ? default : Properties.ThroughputMibps; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.ThroughputMibps = value.Value; + } + } + + /// DataProtection type volumes include an object containing details of the replication. + public VolumePatchPropertiesDataProtection DataProtection + { + get + { + return Properties is null ? default : Properties.DataProtection; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.DataProtection = value; + } + } + + /// Specifies if default quota is enabled for the volume. + public bool? IsDefaultQuotaEnabled + { + get + { + return Properties is null ? default : Properties.IsDefaultQuotaEnabled; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.IsDefaultQuotaEnabled = value.Value; + } + } + + /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . + public long? DefaultUserQuotaInKiBs + { + get + { + return Properties is null ? default : Properties.DefaultUserQuotaInKiBs; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.DefaultUserQuotaInKiBs = value.Value; + } + } + + /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. + public long? DefaultGroupQuotaInKiBs + { + get + { + return Properties is null ? default : Properties.DefaultGroupQuotaInKiBs; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.DefaultGroupQuotaInKiBs = value.Value; + } + } + + /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. + public string UnixPermissions + { + get + { + return Properties is null ? default : Properties.UnixPermissions; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.UnixPermissions = value; + } + } + + /// Specifies whether Cool Access(tiering) is enabled for the volume. + public bool? CoolAccess + { + get + { + return Properties is null ? default : Properties.CoolAccess; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.CoolAccess = value.Value; + } + } + + /// Specifies the number of days after which data that is not accessed by clients will be tiered. + public int? CoolnessPeriod + { + get + { + return Properties is null ? default : Properties.CoolnessPeriod; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.CoolnessPeriod = value.Value; + } + } + + /// + /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. + /// + public CoolAccessRetrievalPolicy? CoolAccessRetrievalPolicy + { + get + { + return Properties is null ? default : Properties.CoolAccessRetrievalPolicy; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.CoolAccessRetrievalPolicy = value.Value; + } + } + + /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. + public CoolAccessTieringPolicy? CoolAccessTieringPolicy + { + get + { + return Properties is null ? default : Properties.CoolAccessTieringPolicy; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.CoolAccessTieringPolicy = value.Value; + } + } + + /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots. + public bool? SnapshotDirectoryVisible + { + get + { + return Properties is null ? default : Properties.SnapshotDirectoryVisible; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.SnapshotDirectoryVisible = value.Value; + } + } + + /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. + public SmbAccessBasedEnumeration? SmbAccessBasedEnumeration + { + get + { + return Properties is null ? default : Properties.SmbAccessBasedEnumeration; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.SmbAccessBasedEnumeration = value.Value; + } + } + + /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. + public SmbNonBrowsable? SmbNonBrowsable + { + get + { + return Properties is null ? default : Properties.SmbNonBrowsable; + } + set + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + Properties.SmbNonBrowsable = value.Value; + } + } + + /// Export policy rule. + public IList ExportRules + { + get + { + if (Properties is null) + { + Properties = new VolumePatchProperties(); + } + return Properties.ExportRules; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchProperties.Serialization.cs new file mode 100644 index 000000000000..982ff2faa2d3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchProperties.Serialization.cs @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Patchable volume properties. + internal partial class VolumePatchProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumePatchProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(ServiceLevel)) + { + writer.WritePropertyName("serviceLevel"u8); + writer.WriteStringValue(ServiceLevel.Value.ToString()); + } + if (Optional.IsDefined(UsageThreshold)) + { + writer.WritePropertyName("usageThreshold"u8); + writer.WriteNumberValue(UsageThreshold.Value); + } + if (Optional.IsDefined(ExportPolicy)) + { + writer.WritePropertyName("exportPolicy"u8); + writer.WriteObjectValue(ExportPolicy, options); + } + if (Optional.IsCollectionDefined(ProtocolTypes)) + { + writer.WritePropertyName("protocolTypes"u8); + writer.WriteStartArray(); + foreach (string item in ProtocolTypes) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ThroughputMibps)) + { + writer.WritePropertyName("throughputMibps"u8); + writer.WriteNumberValue(ThroughputMibps.Value); + } + if (Optional.IsDefined(DataProtection)) + { + writer.WritePropertyName("dataProtection"u8); + writer.WriteObjectValue(DataProtection, options); + } + if (Optional.IsDefined(IsDefaultQuotaEnabled)) + { + writer.WritePropertyName("isDefaultQuotaEnabled"u8); + writer.WriteBooleanValue(IsDefaultQuotaEnabled.Value); + } + if (Optional.IsDefined(DefaultUserQuotaInKiBs)) + { + writer.WritePropertyName("defaultUserQuotaInKiBs"u8); + writer.WriteNumberValue(DefaultUserQuotaInKiBs.Value); + } + if (Optional.IsDefined(DefaultGroupQuotaInKiBs)) + { + writer.WritePropertyName("defaultGroupQuotaInKiBs"u8); + writer.WriteNumberValue(DefaultGroupQuotaInKiBs.Value); + } + if (Optional.IsDefined(UnixPermissions)) + { + writer.WritePropertyName("unixPermissions"u8); + writer.WriteStringValue(UnixPermissions); + } + if (Optional.IsDefined(CoolAccess)) + { + writer.WritePropertyName("coolAccess"u8); + writer.WriteBooleanValue(CoolAccess.Value); + } + if (Optional.IsDefined(CoolnessPeriod)) + { + writer.WritePropertyName("coolnessPeriod"u8); + writer.WriteNumberValue(CoolnessPeriod.Value); + } + if (Optional.IsDefined(CoolAccessRetrievalPolicy)) + { + writer.WritePropertyName("coolAccessRetrievalPolicy"u8); + writer.WriteStringValue(CoolAccessRetrievalPolicy.Value.ToString()); + } + if (Optional.IsDefined(CoolAccessTieringPolicy)) + { + writer.WritePropertyName("coolAccessTieringPolicy"u8); + writer.WriteStringValue(CoolAccessTieringPolicy.Value.ToString()); + } + if (Optional.IsDefined(SnapshotDirectoryVisible)) + { + writer.WritePropertyName("snapshotDirectoryVisible"u8); + writer.WriteBooleanValue(SnapshotDirectoryVisible.Value); + } + if (Optional.IsDefined(SmbAccessBasedEnumeration)) + { + writer.WritePropertyName("smbAccessBasedEnumeration"u8); + writer.WriteStringValue(SmbAccessBasedEnumeration.Value.ToString()); + } + if (Optional.IsDefined(SmbNonBrowsable)) + { + writer.WritePropertyName("smbNonBrowsable"u8); + writer.WriteStringValue(SmbNonBrowsable.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumePatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumePatchProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumePatchProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumePatchProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumePatchProperties DeserializeVolumePatchProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NetAppFileServiceLevel? serviceLevel = default; + long? usageThreshold = default; + VolumePatchPropertiesExportPolicy exportPolicy = default; + IList protocolTypes = default; + float? throughputMibps = default; + VolumePatchPropertiesDataProtection dataProtection = default; + bool? isDefaultQuotaEnabled = default; + long? defaultUserQuotaInKiBs = default; + long? defaultGroupQuotaInKiBs = default; + string unixPermissions = default; + bool? coolAccess = default; + int? coolnessPeriod = default; + CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = default; + CoolAccessTieringPolicy? coolAccessTieringPolicy = default; + bool? snapshotDirectoryVisible = default; + SmbAccessBasedEnumeration? smbAccessBasedEnumeration = default; + SmbNonBrowsable? smbNonBrowsable = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("serviceLevel"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceLevel = new NetAppFileServiceLevel(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("usageThreshold"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usageThreshold = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("exportPolicy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + exportPolicy = VolumePatchPropertiesExportPolicy.DeserializeVolumePatchPropertiesExportPolicy(prop.Value, options); + continue; + } + if (prop.NameEquals("protocolTypes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + protocolTypes = array; + continue; + } + if (prop.NameEquals("throughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + throughputMibps = prop.Value.GetSingle(); + continue; + } + if (prop.NameEquals("dataProtection"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataProtection = VolumePatchPropertiesDataProtection.DeserializeVolumePatchPropertiesDataProtection(prop.Value, options); + continue; + } + if (prop.NameEquals("isDefaultQuotaEnabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDefaultQuotaEnabled = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("defaultUserQuotaInKiBs"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultUserQuotaInKiBs = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("defaultGroupQuotaInKiBs"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultGroupQuotaInKiBs = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("unixPermissions"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + unixPermissions = null; + continue; + } + unixPermissions = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("coolAccess"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coolAccess = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("coolnessPeriod"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coolnessPeriod = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("coolAccessRetrievalPolicy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coolAccessRetrievalPolicy = new CoolAccessRetrievalPolicy(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("coolAccessTieringPolicy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coolAccessTieringPolicy = new CoolAccessTieringPolicy(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("snapshotDirectoryVisible"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotDirectoryVisible = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("smbAccessBasedEnumeration"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + smbAccessBasedEnumeration = null; + continue; + } + smbAccessBasedEnumeration = new SmbAccessBasedEnumeration(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbNonBrowsable"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbNonBrowsable = new SmbNonBrowsable(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumePatchProperties( + serviceLevel, + usageThreshold, + exportPolicy, + protocolTypes ?? new ChangeTrackingList(), + throughputMibps, + dataProtection, + isDefaultQuotaEnabled, + defaultUserQuotaInKiBs, + defaultGroupQuotaInKiBs, + unixPermissions, + coolAccess, + coolnessPeriod, + coolAccessRetrievalPolicy, + coolAccessTieringPolicy, + snapshotDirectoryVisible, + smbAccessBasedEnumeration, + smbNonBrowsable, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumePatchProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumePatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumePatchProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumePatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumePatchProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchProperties.cs similarity index 56% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatch.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchProperties.cs index f286d5bbbc07..0c25e7f9a3a4 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumePatch.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchProperties.cs @@ -7,62 +7,29 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - /// Volume patch resource. - public partial class NetAppVolumePatch : TrackedResourceData + /// Patchable volume properties. + internal partial class VolumePatchProperties { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; - /// Initializes a new instance of . - /// The location. - public NetAppVolumePatch(AzureLocation location) : base(location) + /// Initializes a new instance of . + public VolumePatchProperties() { ProtocolTypes = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + /// Initializes a new instance of . /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// /// Set of export policy rules. /// Set of protocol types, default NFSv3, CIFS for SMB protocol. /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. @@ -71,20 +38,20 @@ public NetAppVolumePatch(AzureLocation location) : base(location) /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - /// Specifies whether Cool Access(tiering) is enabled for the volume. + /// Specifies whether Cool Access(tiering) is enabled for the volume. /// Specifies the number of days after which data that is not accessed by clients will be tiered. /// /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. /// /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots. + /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots. /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetAppFileServiceLevel? serviceLevel, long? usageThreshold, VolumePatchPropertiesExportPolicy exportPolicy, IList protocolTypes, float? throughputMibps, NetAppVolumePatchDataProtection dataProtection, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, string unixPermissions, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, CoolAccessTieringPolicy? coolAccessTieringPolicy, bool? isSnapshotDirectoryVisible, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Keeps track of any properties unknown to the library. + internal VolumePatchProperties(NetAppFileServiceLevel? serviceLevel, long? usageThreshold, VolumePatchPropertiesExportPolicy exportPolicy, IList protocolTypes, float? throughputMibps, VolumePatchPropertiesDataProtection dataProtection, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, string unixPermissions, bool? coolAccess, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, CoolAccessTieringPolicy? coolAccessTieringPolicy, bool? snapshotDirectoryVisible, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, IDictionary additionalBinaryDataProperties) { ServiceLevel = serviceLevel; UsageThreshold = usageThreshold; @@ -96,70 +63,77 @@ internal NetAppVolumePatch(ResourceIdentifier id, string name, ResourceType reso DefaultUserQuotaInKiBs = defaultUserQuotaInKiBs; DefaultGroupQuotaInKiBs = defaultGroupQuotaInKiBs; UnixPermissions = unixPermissions; - IsCoolAccessEnabled = isCoolAccessEnabled; + CoolAccess = coolAccess; CoolnessPeriod = coolnessPeriod; CoolAccessRetrievalPolicy = coolAccessRetrievalPolicy; CoolAccessTieringPolicy = coolAccessTieringPolicy; - IsSnapshotDirectoryVisible = isSnapshotDirectoryVisible; + SnapshotDirectoryVisible = snapshotDirectoryVisible; SmbAccessBasedEnumeration = smbAccessBasedEnumeration; SmbNonBrowsable = smbNonBrowsable; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppVolumePatch() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The service level of the file system. public NetAppFileServiceLevel? ServiceLevel { get; set; } - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. + + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// public long? UsageThreshold { get; set; } + /// Set of export policy rules. internal VolumePatchPropertiesExportPolicy ExportPolicy { get; set; } - /// Export policy rule. - public IList ExportRules - { - get - { - if (ExportPolicy is null) - ExportPolicy = new VolumePatchPropertiesExportPolicy(); - return ExportPolicy.Rules; - } - } /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - public IList ProtocolTypes { get; } + public IList ProtocolTypes { get; } = new ChangeTrackingList(); + /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. public float? ThroughputMibps { get; set; } + /// DataProtection type volumes include an object containing details of the replication. - public NetAppVolumePatchDataProtection DataProtection { get; set; } + public VolumePatchPropertiesDataProtection DataProtection { get; set; } + /// Specifies if default quota is enabled for the volume. public bool? IsDefaultQuotaEnabled { get; set; } + /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . public long? DefaultUserQuotaInKiBs { get; set; } + /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. public long? DefaultGroupQuotaInKiBs { get; set; } + /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. public string UnixPermissions { get; set; } + /// Specifies whether Cool Access(tiering) is enabled for the volume. - public bool? IsCoolAccessEnabled { get; set; } + public bool? CoolAccess { get; set; } + /// Specifies the number of days after which data that is not accessed by clients will be tiered. public int? CoolnessPeriod { get; set; } + /// /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. /// public CoolAccessRetrievalPolicy? CoolAccessRetrievalPolicy { get; set; } + /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. public CoolAccessTieringPolicy? CoolAccessTieringPolicy { get; set; } + /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots. - public bool? IsSnapshotDirectoryVisible { get; set; } + public bool? SnapshotDirectoryVisible { get; set; } + /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. public SmbAccessBasedEnumeration? SmbAccessBasedEnumeration { get; set; } + /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. public SmbNonBrowsable? SmbNonBrowsable { get; set; } + + /// Export policy rule. + public IList ExportRules { get; } = new ChangeTrackingList(); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesDataProtection.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesDataProtection.Serialization.cs new file mode 100644 index 000000000000..fa7712dbe61d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesDataProtection.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// DataProtection type volumes include an object containing details of the replication. + public partial class VolumePatchPropertiesDataProtection : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumePatchPropertiesDataProtection)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Backup)) + { + writer.WritePropertyName("backup"u8); + writer.WriteObjectValue(Backup, options); + } + if (Optional.IsDefined(Snapshot)) + { + writer.WritePropertyName("snapshot"u8); + writer.WriteObjectValue(Snapshot, options); + } + if (Optional.IsDefined(RansomwareProtection)) + { + writer.WritePropertyName("ransomwareProtection"u8); + writer.WriteObjectValue(RansomwareProtection, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumePatchPropertiesDataProtection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumePatchPropertiesDataProtection JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumePatchPropertiesDataProtection)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumePatchPropertiesDataProtection(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumePatchPropertiesDataProtection DeserializeVolumePatchPropertiesDataProtection(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VolumeBackupProperties backup = default; + VolumeSnapshotProperties snapshot = default; + RansomwareProtectionPatchSettings ransomwareProtection = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("backup"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backup = VolumeBackupProperties.DeserializeVolumeBackupProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("snapshot"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshot = VolumeSnapshotProperties.DeserializeVolumeSnapshotProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("ransomwareProtection"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ransomwareProtection = RansomwareProtectionPatchSettings.DeserializeRansomwareProtectionPatchSettings(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumePatchPropertiesDataProtection(backup, snapshot, ransomwareProtection, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumePatchPropertiesDataProtection)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumePatchPropertiesDataProtection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumePatchPropertiesDataProtection PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumePatchPropertiesDataProtection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumePatchPropertiesDataProtection)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesDataProtection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesDataProtection.cs new file mode 100644 index 000000000000..c11dc1330016 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesDataProtection.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// DataProtection type volumes include an object containing details of the replication. + public partial class VolumePatchPropertiesDataProtection + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumePatchPropertiesDataProtection() + { + } + + /// Initializes a new instance of . + /// Backup Properties. + /// Snapshot properties. + /// Advanced Ransomware Protection updatable settings. + /// Keeps track of any properties unknown to the library. + internal VolumePatchPropertiesDataProtection(VolumeBackupProperties backup, VolumeSnapshotProperties snapshot, RansomwareProtectionPatchSettings ransomwareProtection, IDictionary additionalBinaryDataProperties) + { + Backup = backup; + Snapshot = snapshot; + RansomwareProtection = ransomwareProtection; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Backup Properties. + public VolumeBackupProperties Backup { get; set; } + + /// Snapshot properties. + internal VolumeSnapshotProperties Snapshot { get; set; } + + /// Advanced Ransomware Protection updatable settings. + internal RansomwareProtectionPatchSettings RansomwareProtection { get; set; } + + /// Snapshot Policy ResourceId. + public string SnapshotPolicyId + { + get + { + return Snapshot is null ? default : Snapshot.SnapshotPolicyId; + } + set + { + if (Snapshot is null) + { + Snapshot = new VolumeSnapshotProperties(); + } + Snapshot.SnapshotPolicyId = value; + } + } + + /// The desired value of the ARP feature state available to the volume. + public DesiredRansomwareProtectionState? DesiredRansomwareProtectionState + { + get + { + return RansomwareProtection is null ? default : RansomwareProtection.DesiredRansomwareProtectionState; + } + set + { + if (RansomwareProtection is null) + { + RansomwareProtection = new RansomwareProtectionPatchSettings(); + } + RansomwareProtection.DesiredRansomwareProtectionState = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesExportPolicy.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesExportPolicy.Serialization.cs index 5a8f2d86f01d..1a43852e5633 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesExportPolicy.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesExportPolicy.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class VolumePatchPropertiesExportPolicy : IUtf8JsonSerializable, IJsonModel + /// Set of export policy rules. + internal partial class VolumePatchPropertiesExportPolicy : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +29,30 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VolumePatchPropertiesExportPolicy)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Rules)) { writer.WritePropertyName("rules"u8); writer.WriteStartArray(); - foreach (var item in Rules) + foreach (ExportPolicyRule item in Rules) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +61,64 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VolumePatchPropertiesExportPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + VolumePatchPropertiesExportPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumePatchPropertiesExportPolicy JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VolumePatchPropertiesExportPolicy)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeVolumePatchPropertiesExportPolicy(document.RootElement, options); } - internal static VolumePatchPropertiesExportPolicy DeserializeVolumePatchPropertiesExportPolicy(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumePatchPropertiesExportPolicy DeserializeVolumePatchPropertiesExportPolicy(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IList rules = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList rules = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("rules"u8)) + if (prop.NameEquals("rules"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(NetAppVolumeExportPolicyRule.DeserializeNetAppVolumeExportPolicyRule(item, options)); + array.Add(ExportPolicyRule.DeserializeExportPolicyRule(item, options)); } rules = array; continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new VolumePatchPropertiesExportPolicy(rules ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new VolumePatchPropertiesExportPolicy(rules ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +128,20 @@ BinaryData IPersistableModel.Write(ModelReade } } - VolumePatchPropertiesExportPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + VolumePatchPropertiesExportPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumePatchPropertiesExportPolicy PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeVolumePatchPropertiesExportPolicy(document.RootElement, options); } default: @@ -138,6 +149,7 @@ VolumePatchPropertiesExportPolicy IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesExportPolicy.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesExportPolicy.cs index 8a3e19c3de07..d5ae44f77fbb 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesExportPolicy.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePatchPropertiesExportPolicy.cs @@ -7,60 +7,32 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// Set of export policy rules. internal partial class VolumePatchPropertiesExportPolicy { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public VolumePatchPropertiesExportPolicy() { - Rules = new ChangeTrackingList(); + Rules = new ChangeTrackingList(); } /// Initializes a new instance of . /// Export policy rule. - /// Keeps track of any properties unknown to the library. - internal VolumePatchPropertiesExportPolicy(IList rules, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal VolumePatchPropertiesExportPolicy(IList rules, IDictionary additionalBinaryDataProperties) { Rules = rules; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Export policy rule. - public IList Rules { get; } + public IList Rules { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeProperties.Serialization.cs new file mode 100644 index 000000000000..bd4f34af0a44 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeProperties.Serialization.cs @@ -0,0 +1,1137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume properties. + internal partial class VolumeProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal VolumeProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(FileSystemId)) + { + writer.WritePropertyName("fileSystemId"u8); + writer.WriteStringValue(FileSystemId); + } + writer.WritePropertyName("creationToken"u8); + writer.WriteStringValue(CreationToken); + if (Optional.IsDefined(ServiceLevel)) + { + writer.WritePropertyName("serviceLevel"u8); + writer.WriteStringValue(ServiceLevel.Value.ToString()); + } + writer.WritePropertyName("usageThreshold"u8); + writer.WriteNumberValue(UsageThreshold); + if (Optional.IsDefined(ExportPolicy)) + { + writer.WritePropertyName("exportPolicy"u8); + writer.WriteObjectValue(ExportPolicy, options); + } + if (Optional.IsCollectionDefined(ProtocolTypes)) + { + writer.WritePropertyName("protocolTypes"u8); + writer.WriteStartArray(); + foreach (string item in ProtocolTypes) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (Optional.IsDefined(SnapshotId)) + { + writer.WritePropertyName("snapshotId"u8); + writer.WriteStringValue(SnapshotId); + } + if (Optional.IsDefined(DeleteBaseSnapshot)) + { + writer.WritePropertyName("deleteBaseSnapshot"u8); + writer.WriteBooleanValue(DeleteBaseSnapshot.Value); + } + if (Optional.IsDefined(BackupId)) + { + writer.WritePropertyName("backupId"u8); + writer.WriteStringValue(BackupId); + } + if (options.Format != "W" && Optional.IsDefined(BaremetalTenantId)) + { + writer.WritePropertyName("baremetalTenantId"u8); + writer.WriteStringValue(BaremetalTenantId); + } + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + if (Optional.IsDefined(NetworkFeatures)) + { + writer.WritePropertyName("networkFeatures"u8); + writer.WriteStringValue(NetworkFeatures.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(EffectiveNetworkFeatures)) + { + writer.WritePropertyName("effectiveNetworkFeatures"u8); + writer.WriteStringValue(EffectiveNetworkFeatures.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(NetworkSiblingSetId)) + { + writer.WritePropertyName("networkSiblingSetId"u8); + writer.WriteStringValue(NetworkSiblingSetId); + } + if (options.Format != "W" && Optional.IsDefined(StorageToNetworkProximity)) + { + writer.WritePropertyName("storageToNetworkProximity"u8); + writer.WriteStringValue(StorageToNetworkProximity.Value.ToString()); + } + if (options.Format != "W" && Optional.IsCollectionDefined(MountTargets)) + { + writer.WritePropertyName("mountTargets"u8); + writer.WriteStartArray(); + foreach (MountTargetProperties item in MountTargets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(VolumeType)) + { + writer.WritePropertyName("volumeType"u8); + writer.WriteStringValue(VolumeType); + } + if (Optional.IsDefined(DataProtection)) + { + writer.WritePropertyName("dataProtection"u8); + writer.WriteObjectValue(DataProtection, options); + } + if (Optional.IsDefined(AcceptGrowCapacityPoolForShortTermCloneSplit)) + { + writer.WritePropertyName("acceptGrowCapacityPoolForShortTermCloneSplit"u8); + writer.WriteStringValue(AcceptGrowCapacityPoolForShortTermCloneSplit.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(IsRestoring)) + { + writer.WritePropertyName("isRestoring"u8); + writer.WriteBooleanValue(IsRestoring.Value); + } + if (Optional.IsDefined(SnapshotDirectoryVisible)) + { + writer.WritePropertyName("snapshotDirectoryVisible"u8); + writer.WriteBooleanValue(SnapshotDirectoryVisible.Value); + } + if (Optional.IsDefined(KerberosEnabled)) + { + writer.WritePropertyName("kerberosEnabled"u8); + writer.WriteBooleanValue(KerberosEnabled.Value); + } + if (Optional.IsDefined(SecurityStyle)) + { + writer.WritePropertyName("securityStyle"u8); + writer.WriteStringValue(SecurityStyle.Value.ToString()); + } + if (Optional.IsDefined(SmbEncryption)) + { + writer.WritePropertyName("smbEncryption"u8); + writer.WriteBooleanValue(SmbEncryption.Value); + } + if (Optional.IsDefined(SmbAccessBasedEnumeration)) + { + writer.WritePropertyName("smbAccessBasedEnumeration"u8); + writer.WriteStringValue(SmbAccessBasedEnumeration.Value.ToString()); + } + if (Optional.IsDefined(SmbNonBrowsable)) + { + writer.WritePropertyName("smbNonBrowsable"u8); + writer.WriteStringValue(SmbNonBrowsable.Value.ToString()); + } + if (Optional.IsDefined(SmbContinuouslyAvailable)) + { + writer.WritePropertyName("smbContinuouslyAvailable"u8); + writer.WriteBooleanValue(SmbContinuouslyAvailable.Value); + } + if (Optional.IsDefined(ThroughputMibps)) + { + writer.WritePropertyName("throughputMibps"u8); + writer.WriteNumberValue(ThroughputMibps.Value); + } + if (options.Format != "W" && Optional.IsDefined(ActualThroughputMibps)) + { + writer.WritePropertyName("actualThroughputMibps"u8); + writer.WriteNumberValue(ActualThroughputMibps.Value); + } + if (Optional.IsDefined(EncryptionKeySource)) + { + writer.WritePropertyName("encryptionKeySource"u8); + writer.WriteStringValue(EncryptionKeySource.Value.ToString()); + } + if (Optional.IsDefined(KeyVaultPrivateEndpointResourceId)) + { + writer.WritePropertyName("keyVaultPrivateEndpointResourceId"u8); + writer.WriteStringValue(KeyVaultPrivateEndpointResourceId); + } + if (Optional.IsDefined(LdapEnabled)) + { + writer.WritePropertyName("ldapEnabled"u8); + writer.WriteBooleanValue(LdapEnabled.Value); + } + if (Optional.IsDefined(LdapServerType)) + { + writer.WritePropertyName("ldapServerType"u8); + writer.WriteStringValue(LdapServerType.Value.ToString()); + } + if (Optional.IsDefined(CoolAccess)) + { + writer.WritePropertyName("coolAccess"u8); + writer.WriteBooleanValue(CoolAccess.Value); + } + if (Optional.IsDefined(CoolnessPeriod)) + { + writer.WritePropertyName("coolnessPeriod"u8); + writer.WriteNumberValue(CoolnessPeriod.Value); + } + if (Optional.IsDefined(CoolAccessRetrievalPolicy)) + { + writer.WritePropertyName("coolAccessRetrievalPolicy"u8); + writer.WriteStringValue(CoolAccessRetrievalPolicy.Value.ToString()); + } + if (Optional.IsDefined(CoolAccessTieringPolicy)) + { + writer.WritePropertyName("coolAccessTieringPolicy"u8); + writer.WriteStringValue(CoolAccessTieringPolicy.Value.ToString()); + } + if (Optional.IsDefined(UnixPermissions)) + { + writer.WritePropertyName("unixPermissions"u8); + writer.WriteStringValue(UnixPermissions); + } + if (options.Format != "W" && Optional.IsDefined(CloneProgress)) + { + writer.WritePropertyName("cloneProgress"u8); + writer.WriteNumberValue(CloneProgress.Value); + } + if (options.Format != "W" && Optional.IsDefined(FileAccessLogs)) + { + writer.WritePropertyName("fileAccessLogs"u8); + writer.WriteStringValue(FileAccessLogs.Value.ToString()); + } + if (Optional.IsDefined(AvsDataStore)) + { + writer.WritePropertyName("avsDataStore"u8); + writer.WriteStringValue(AvsDataStore.Value.ToString()); + } + if (options.Format != "W" && Optional.IsCollectionDefined(DataStoreResourceId)) + { + writer.WritePropertyName("dataStoreResourceId"u8); + writer.WriteStartArray(); + foreach (string item in DataStoreResourceId) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(IsDefaultQuotaEnabled)) + { + writer.WritePropertyName("isDefaultQuotaEnabled"u8); + writer.WriteBooleanValue(IsDefaultQuotaEnabled.Value); + } + if (Optional.IsDefined(DefaultUserQuotaInKiBs)) + { + writer.WritePropertyName("defaultUserQuotaInKiBs"u8); + writer.WriteNumberValue(DefaultUserQuotaInKiBs.Value); + } + if (Optional.IsDefined(DefaultGroupQuotaInKiBs)) + { + writer.WritePropertyName("defaultGroupQuotaInKiBs"u8); + writer.WriteNumberValue(DefaultGroupQuotaInKiBs.Value); + } + if (options.Format != "W" && Optional.IsDefined(MaximumNumberOfFiles)) + { + writer.WritePropertyName("maximumNumberOfFiles"u8); + writer.WriteNumberValue(MaximumNumberOfFiles.Value); + } + if (options.Format != "W" && Optional.IsDefined(VolumeGroupName)) + { + writer.WritePropertyName("volumeGroupName"u8); + writer.WriteStringValue(VolumeGroupName); + } + if (Optional.IsDefined(CapacityPoolResourceId)) + { + writer.WritePropertyName("capacityPoolResourceId"u8); + writer.WriteStringValue(CapacityPoolResourceId); + } + if (Optional.IsDefined(ProximityPlacementGroup)) + { + writer.WritePropertyName("proximityPlacementGroup"u8); + writer.WriteStringValue(ProximityPlacementGroup); + } + if (options.Format != "W" && Optional.IsDefined(T2Network)) + { + writer.WritePropertyName("t2Network"u8); + writer.WriteStringValue(T2Network); + } + if (Optional.IsDefined(VolumeSpecName)) + { + writer.WritePropertyName("volumeSpecName"u8); + writer.WriteStringValue(VolumeSpecName); + } + if (options.Format != "W" && Optional.IsDefined(Encrypted)) + { + writer.WritePropertyName("encrypted"u8); + writer.WriteBooleanValue(Encrypted.Value); + } + if (Optional.IsCollectionDefined(PlacementRules)) + { + writer.WritePropertyName("placementRules"u8); + writer.WriteStartArray(); + foreach (NetAppVolumePlacementRule item in PlacementRules) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(EnableSubvolumes)) + { + writer.WritePropertyName("enableSubvolumes"u8); + writer.WriteStringValue(EnableSubvolumes.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisionedAvailabilityZone)) + { + writer.WritePropertyName("provisionedAvailabilityZone"u8); + writer.WriteStringValue(ProvisionedAvailabilityZone); + } + if (Optional.IsDefined(IsLargeVolume)) + { + writer.WritePropertyName("isLargeVolume"u8); + writer.WriteBooleanValue(IsLargeVolume.Value); + } + if (Optional.IsDefined(LargeVolumeType)) + { + writer.WritePropertyName("largeVolumeType"u8); + writer.WriteStringValue(LargeVolumeType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(OriginatingResourceId)) + { + writer.WritePropertyName("originatingResourceId"u8); + writer.WriteStringValue(OriginatingResourceId); + } + if (options.Format != "W" && Optional.IsDefined(InheritedSizeInBytes)) + { + writer.WritePropertyName("inheritedSizeInBytes"u8); + writer.WriteNumberValue(InheritedSizeInBytes.Value); + } + if (Optional.IsDefined(Language)) + { + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language.Value.ToString()); + } + if (Optional.IsDefined(BreakthroughMode)) + { + writer.WritePropertyName("breakthroughMode"u8); + writer.WriteStringValue(BreakthroughMode.Value.ToString()); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeProperties DeserializeVolumeProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileSystemId = default; + string creationToken = default; + NetAppFileServiceLevel? serviceLevel = default; + long usageThreshold = default; + NetAppVolumeExportPolicyRule exportPolicy = default; + IList protocolTypes = default; + string provisioningState = default; + ResourceIdentifier snapshotId = default; + bool? deleteBaseSnapshot = default; + ResourceIdentifier backupId = default; + string baremetalTenantId = default; + string subnetId = default; + NetworkFeatures? networkFeatures = default; + NetworkFeatures? effectiveNetworkFeatures = default; + string networkSiblingSetId = default; + VolumeStorageToNetworkProximity? storageToNetworkProximity = default; + IReadOnlyList mountTargets = default; + string volumeType = default; + VolumePropertiesDataProtection dataProtection = default; + AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit = default; + bool? isRestoring = default; + bool? snapshotDirectoryVisible = default; + bool? kerberosEnabled = default; + SecurityStyle? securityStyle = default; + bool? smbEncryption = default; + SmbAccessBasedEnumeration? smbAccessBasedEnumeration = default; + SmbNonBrowsable? smbNonBrowsable = default; + bool? smbContinuouslyAvailable = default; + float? throughputMibps = default; + float? actualThroughputMibps = default; + EncryptionKeySource? encryptionKeySource = default; + string keyVaultPrivateEndpointResourceId = default; + bool? ldapEnabled = default; + LdapServerType? ldapServerType = default; + bool? coolAccess = default; + int? coolnessPeriod = default; + CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = default; + CoolAccessTieringPolicy? coolAccessTieringPolicy = default; + string unixPermissions = default; + int? cloneProgress = default; + FileAccessLogs? fileAccessLogs = default; + AvsDataStore? avsDataStore = default; + IReadOnlyList dataStoreResourceId = default; + bool? isDefaultQuotaEnabled = default; + long? defaultUserQuotaInKiBs = default; + long? defaultGroupQuotaInKiBs = default; + long? maximumNumberOfFiles = default; + string volumeGroupName = default; + string capacityPoolResourceId = default; + string proximityPlacementGroup = default; + string t2Network = default; + string volumeSpecName = default; + bool? encrypted = default; + IList placementRules = default; + EnableSubvolumes? enableSubvolumes = default; + string provisionedAvailabilityZone = default; + bool? isLargeVolume = default; + LargeVolumeType? largeVolumeType = default; + string originatingResourceId = default; + long? inheritedSizeInBytes = default; + VolumeLanguage? language = default; + BreakthroughMode? breakthroughMode = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("fileSystemId"u8)) + { + fileSystemId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("creationToken"u8)) + { + creationToken = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("serviceLevel"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceLevel = new NetAppFileServiceLevel(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("usageThreshold"u8)) + { + usageThreshold = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("exportPolicy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + exportPolicy = NetAppVolumeExportPolicyRule.DeserializeNetAppVolumeExportPolicyRule(prop.Value, options); + continue; + } + if (prop.NameEquals("protocolTypes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + protocolTypes = array; + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("snapshotId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + snapshotId = null; + continue; + } + snapshotId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("deleteBaseSnapshot"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteBaseSnapshot = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("backupId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + backupId = null; + continue; + } + backupId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("baremetalTenantId"u8)) + { + baremetalTenantId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("subnetId"u8)) + { + subnetId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("networkFeatures"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkFeatures = new NetworkFeatures(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("effectiveNetworkFeatures"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + effectiveNetworkFeatures = new NetworkFeatures(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("networkSiblingSetId"u8)) + { + networkSiblingSetId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("storageToNetworkProximity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageToNetworkProximity = new VolumeStorageToNetworkProximity(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("mountTargets"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(MountTargetProperties.DeserializeMountTargetProperties(item, options)); + } + mountTargets = array; + continue; + } + if (prop.NameEquals("volumeType"u8)) + { + volumeType = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("dataProtection"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataProtection = VolumePropertiesDataProtection.DeserializeVolumePropertiesDataProtection(prop.Value, options); + continue; + } + if (prop.NameEquals("acceptGrowCapacityPoolForShortTermCloneSplit"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + acceptGrowCapacityPoolForShortTermCloneSplit = new AcceptGrowCapacityPoolForShortTermCloneSplit(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("isRestoring"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isRestoring = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("snapshotDirectoryVisible"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotDirectoryVisible = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("kerberosEnabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kerberosEnabled = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("securityStyle"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityStyle = new SecurityStyle(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbEncryption"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbEncryption = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("smbAccessBasedEnumeration"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + smbAccessBasedEnumeration = null; + continue; + } + smbAccessBasedEnumeration = new SmbAccessBasedEnumeration(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbNonBrowsable"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbNonBrowsable = new SmbNonBrowsable(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("smbContinuouslyAvailable"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smbContinuouslyAvailable = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("throughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + throughputMibps = null; + continue; + } + throughputMibps = prop.Value.GetSingle(); + continue; + } + if (prop.NameEquals("actualThroughputMibps"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + actualThroughputMibps = prop.Value.GetSingle(); + continue; + } + if (prop.NameEquals("encryptionKeySource"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryptionKeySource = new EncryptionKeySource(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("keyVaultPrivateEndpointResourceId"u8)) + { + keyVaultPrivateEndpointResourceId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("ldapEnabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ldapEnabled = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("ldapServerType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ldapServerType = new LdapServerType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("coolAccess"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coolAccess = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("coolnessPeriod"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coolnessPeriod = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("coolAccessRetrievalPolicy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coolAccessRetrievalPolicy = new CoolAccessRetrievalPolicy(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("coolAccessTieringPolicy"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + coolAccessTieringPolicy = new CoolAccessTieringPolicy(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("unixPermissions"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + unixPermissions = null; + continue; + } + unixPermissions = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("cloneProgress"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + cloneProgress = null; + continue; + } + cloneProgress = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("fileAccessLogs"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fileAccessLogs = new FileAccessLogs(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("avsDataStore"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + avsDataStore = new AvsDataStore(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("dataStoreResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + dataStoreResourceId = array; + continue; + } + if (prop.NameEquals("isDefaultQuotaEnabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDefaultQuotaEnabled = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("defaultUserQuotaInKiBs"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultUserQuotaInKiBs = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("defaultGroupQuotaInKiBs"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultGroupQuotaInKiBs = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("maximumNumberOfFiles"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maximumNumberOfFiles = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("volumeGroupName"u8)) + { + volumeGroupName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("capacityPoolResourceId"u8)) + { + capacityPoolResourceId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("proximityPlacementGroup"u8)) + { + proximityPlacementGroup = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("t2Network"u8)) + { + t2Network = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("volumeSpecName"u8)) + { + volumeSpecName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("encrypted"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encrypted = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("placementRules"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(NetAppVolumePlacementRule.DeserializeNetAppVolumePlacementRule(item, options)); + } + placementRules = array; + continue; + } + if (prop.NameEquals("enableSubvolumes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableSubvolumes = new EnableSubvolumes(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("provisionedAvailabilityZone"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + provisionedAvailabilityZone = null; + continue; + } + provisionedAvailabilityZone = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("isLargeVolume"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isLargeVolume = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("largeVolumeType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + largeVolumeType = new LargeVolumeType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("originatingResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + originatingResourceId = null; + continue; + } + originatingResourceId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("inheritedSizeInBytes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + inheritedSizeInBytes = null; + continue; + } + inheritedSizeInBytes = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("language"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + language = new VolumeLanguage(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("breakthroughMode"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + breakthroughMode = new BreakthroughMode(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeProperties( + fileSystemId, + creationToken, + serviceLevel, + usageThreshold, + exportPolicy, + protocolTypes ?? new ChangeTrackingList(), + provisioningState, + snapshotId, + deleteBaseSnapshot, + backupId, + baremetalTenantId, + subnetId, + networkFeatures, + effectiveNetworkFeatures, + networkSiblingSetId, + storageToNetworkProximity, + mountTargets ?? new ChangeTrackingList(), + volumeType, + dataProtection, + acceptGrowCapacityPoolForShortTermCloneSplit, + isRestoring, + snapshotDirectoryVisible, + kerberosEnabled, + securityStyle, + smbEncryption, + smbAccessBasedEnumeration, + smbNonBrowsable, + smbContinuouslyAvailable, + throughputMibps, + actualThroughputMibps, + encryptionKeySource, + keyVaultPrivateEndpointResourceId, + ldapEnabled, + ldapServerType, + coolAccess, + coolnessPeriod, + coolAccessRetrievalPolicy, + coolAccessTieringPolicy, + unixPermissions, + cloneProgress, + fileAccessLogs, + avsDataStore, + dataStoreResourceId ?? new ChangeTrackingList(), + isDefaultQuotaEnabled, + defaultUserQuotaInKiBs, + defaultGroupQuotaInKiBs, + maximumNumberOfFiles, + volumeGroupName, + capacityPoolResourceId, + proximityPlacementGroup, + t2Network, + volumeSpecName, + encrypted, + placementRules ?? new ChangeTrackingList(), + enableSubvolumes, + provisionedAvailabilityZone, + isLargeVolume, + largeVolumeType, + originatingResourceId, + inheritedSizeInBytes, + language, + breakthroughMode, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupVolume.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeProperties.cs similarity index 64% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupVolume.cs rename to sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeProperties.cs index 9c230ebafb11..e90c41a50f22 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/NetAppVolumeGroupVolume.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeProperties.cs @@ -8,75 +8,48 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - /// Volume resource. - public partial class NetAppVolumeGroupVolume + /// Volume properties. + internal partial class VolumeProperties { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; - /// Initializes a new instance of . + /// Initializes a new instance of . /// A unique file path for the volume. Used when creating mount targets. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. /// or is null. - public NetAppVolumeGroupVolume(string creationToken, long usageThreshold, ResourceIdentifier subnetId) + public VolumeProperties(string creationToken, long usageThreshold, string subnetId) { Argument.AssertNotNull(creationToken, nameof(creationToken)); Argument.AssertNotNull(subnetId, nameof(subnetId)); - Tags = new ChangeTrackingDictionary(); - Zones = new ChangeTrackingList(); CreationToken = creationToken; UsageThreshold = usageThreshold; ProtocolTypes = new ChangeTrackingList(); SubnetId = subnetId; - MountTargets = new ChangeTrackingList(); - DataStoreResourceId = new ChangeTrackingList(); + MountTargets = new ChangeTrackingList(); + DataStoreResourceId = new ChangeTrackingList(); PlacementRules = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// Resource Id. - /// Resource name. - /// Resource type. - /// Resource tags. - /// Availability Zone. + /// Initializes a new instance of . /// Unique FileSystem Identifier. /// A unique file path for the volume. Used when creating mount targets. /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// /// Set of export policy rules. /// Set of protocol types, default NFSv3, CIFS for SMB protocol. /// Azure lifecycle management. @@ -94,29 +67,29 @@ public NetAppVolumeGroupVolume(string creationToken, long usageThreshold, Resour /// DataProtection type volumes include an object containing details of the replication. /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. + /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). + /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. + /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. + /// Enables continuously available share property for smb volume. Only applicable for SMB volume. /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. + /// Specifies whether LDAP is enabled or not for a given NFS volume. /// Specifies the type of LDAP server for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. + /// Specifies whether Cool Access(tiering) is enabled for the volume. /// Specifies the number of days after which data that is not accessed by clients will be tiered. /// /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. /// /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. Avoid passing null value for unixPermissions in volume update operation, As per the behavior, If Null value is passed then user-visible unixPermissions value will became null, and user will not be able to get unixPermissions value. On safer side, actual unixPermissions value on volume will remain as its last saved value only. + /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. @@ -127,25 +100,26 @@ public NetAppVolumeGroupVolume(string creationToken, long usageThreshold, Resour /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. /// Volume Group Name. /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. + /// Proximity placement group associated with the volume. /// T2 network information. /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. + /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. /// Application specific placement rules for the particular volume. /// Flag indicating whether subvolume operations are enabled on the volume. /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. /// Specifies whether volume is a Large Volume or Regular Volume. + /// + /// Specifies the type of the Large Volume. When set to 'LargeVolume', the large volume is created with standard configuration. + /// If it is set to 'ExtraLargeVolume7Dot2PiB', the extra large volume is created with higher capacity limit 7.2PiB with cool access enabled, + /// delivering higher capacity limit with lower costs. + /// /// Id of the snapshot or backup that the volume is restored from. /// Space shared by short term clone volume with parent volume in bytes. /// Language supported for volume. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeGroupVolume(ResourceIdentifier id, string name, ResourceType? resourceType, IDictionary tags, IList zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, VolumePropertiesExportPolicy exportPolicy, IList protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, NetAppNetworkFeature? effectiveNetworkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IReadOnlyList mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, LdapServerType? ldapServerType, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, CoolAccessTieringPolicy? coolAccessTieringPolicy, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IReadOnlyList dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IList placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId, long? inheritedSizeInBytes, NetAppVolumeLanguage? language, IDictionary serializedAdditionalRawData) + /// Specifies whether the volume operates in Breakthrough Mode. + /// Keeps track of any properties unknown to the library. + internal VolumeProperties(string fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, NetAppVolumeExportPolicyRule exportPolicy, IList protocolTypes, string provisioningState, ResourceIdentifier snapshotId, bool? deleteBaseSnapshot, ResourceIdentifier backupId, string baremetalTenantId, string subnetId, NetworkFeatures? networkFeatures, NetworkFeatures? effectiveNetworkFeatures, string networkSiblingSetId, VolumeStorageToNetworkProximity? storageToNetworkProximity, IReadOnlyList mountTargets, string volumeType, VolumePropertiesDataProtection dataProtection, AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit, bool? isRestoring, bool? snapshotDirectoryVisible, bool? kerberosEnabled, SecurityStyle? securityStyle, bool? smbEncryption, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? smbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, EncryptionKeySource? encryptionKeySource, string keyVaultPrivateEndpointResourceId, bool? ldapEnabled, LdapServerType? ldapServerType, bool? coolAccess, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, CoolAccessTieringPolicy? coolAccessTieringPolicy, string unixPermissions, int? cloneProgress, FileAccessLogs? fileAccessLogs, AvsDataStore? avsDataStore, IReadOnlyList dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, string capacityPoolResourceId, string proximityPlacementGroup, string t2Network, string volumeSpecName, bool? encrypted, IList placementRules, EnableSubvolumes? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, LargeVolumeType? largeVolumeType, string originatingResourceId, long? inheritedSizeInBytes, VolumeLanguage? language, BreakthroughMode? breakthroughMode, IDictionary additionalBinaryDataProperties) { - Id = id; - Name = name; - ResourceType = resourceType; - Tags = tags; - Zones = zones; FileSystemId = fileSystemId; CreationToken = creationToken; ServiceLevel = serviceLevel; @@ -167,20 +141,20 @@ internal NetAppVolumeGroupVolume(ResourceIdentifier id, string name, ResourceTyp DataProtection = dataProtection; AcceptGrowCapacityPoolForShortTermCloneSplit = acceptGrowCapacityPoolForShortTermCloneSplit; IsRestoring = isRestoring; - IsSnapshotDirectoryVisible = isSnapshotDirectoryVisible; - IsKerberosEnabled = isKerberosEnabled; + SnapshotDirectoryVisible = snapshotDirectoryVisible; + KerberosEnabled = kerberosEnabled; SecurityStyle = securityStyle; - IsSmbEncryptionEnabled = isSmbEncryptionEnabled; + SmbEncryption = smbEncryption; SmbAccessBasedEnumeration = smbAccessBasedEnumeration; SmbNonBrowsable = smbNonBrowsable; - IsSmbContinuouslyAvailable = isSmbContinuouslyAvailable; + SmbContinuouslyAvailable = smbContinuouslyAvailable; ThroughputMibps = throughputMibps; ActualThroughputMibps = actualThroughputMibps; EncryptionKeySource = encryptionKeySource; KeyVaultPrivateEndpointResourceId = keyVaultPrivateEndpointResourceId; - IsLdapEnabled = isLdapEnabled; + LdapEnabled = ldapEnabled; LdapServerType = ldapServerType; - IsCoolAccessEnabled = isCoolAccessEnabled; + CoolAccess = coolAccess; CoolnessPeriod = coolnessPeriod; CoolAccessRetrievalPolicy = coolAccessRetrievalPolicy; CoolAccessTieringPolicy = coolAccessTieringPolicy; @@ -195,168 +169,222 @@ internal NetAppVolumeGroupVolume(ResourceIdentifier id, string name, ResourceTyp MaximumNumberOfFiles = maximumNumberOfFiles; VolumeGroupName = volumeGroupName; CapacityPoolResourceId = capacityPoolResourceId; - ProximityPlacementGroupId = proximityPlacementGroupId; + ProximityPlacementGroup = proximityPlacementGroup; T2Network = t2Network; VolumeSpecName = volumeSpecName; - IsEncrypted = isEncrypted; + Encrypted = encrypted; PlacementRules = placementRules; EnableSubvolumes = enableSubvolumes; ProvisionedAvailabilityZone = provisionedAvailabilityZone; IsLargeVolume = isLargeVolume; + LargeVolumeType = largeVolumeType; OriginatingResourceId = originatingResourceId; InheritedSizeInBytes = inheritedSizeInBytes; Language = language; - _serializedAdditionalRawData = serializedAdditionalRawData; + BreakthroughMode = breakthroughMode; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Initializes a new instance of for deserialization. - internal NetAppVolumeGroupVolume() - { - } - - /// Resource Id. - public ResourceIdentifier Id { get; } - /// Resource name. - public string Name { get; set; } - /// Resource type. - public ResourceType? ResourceType { get; } - /// Resource tags. - public IDictionary Tags { get; } - /// Availability Zone. - public IList Zones { get; } /// Unique FileSystem Identifier. - public Guid? FileSystemId { get; } + public string FileSystemId { get; } + /// A unique file path for the volume. Used when creating mount targets. public string CreationToken { get; set; } + /// The service level of the file system. public NetAppFileServiceLevel? ServiceLevel { get; set; } - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. + + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// public long UsageThreshold { get; set; } + /// Set of export policy rules. - internal VolumePropertiesExportPolicy ExportPolicy { get; set; } - /// Export policy rule. - public IList ExportRules - { - get - { - if (ExportPolicy is null) - ExportPolicy = new VolumePropertiesExportPolicy(); - return ExportPolicy.Rules; - } - } + internal NetAppVolumeExportPolicyRule ExportPolicy { get; set; } /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - public IList ProtocolTypes { get; } + public IList ProtocolTypes { get; } = new ChangeTrackingList(); + /// Azure lifecycle management. public string ProvisioningState { get; } + /// Resource identifier used to identify the Snapshot. - public string SnapshotId { get; set; } + public ResourceIdentifier SnapshotId { get; set; } + /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. public bool? DeleteBaseSnapshot { get; set; } + /// Resource identifier used to identify the Backup. - public string BackupId { get; set; } + public ResourceIdentifier BackupId { get; set; } + /// Unique Baremetal Tenant Identifier. public string BaremetalTenantId { get; } + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - public ResourceIdentifier SubnetId { get; set; } + public string SubnetId { get; set; } + /// The original value of the network features type available to the volume at the time it was created. - public NetAppNetworkFeature? NetworkFeatures { get; set; } + public NetworkFeatures? NetworkFeatures { get; set; } + /// The effective value of the network features type available to the volume, or current effective state of update. - public NetAppNetworkFeature? EffectiveNetworkFeatures { get; } + public NetworkFeatures? EffectiveNetworkFeatures { get; } + /// Network Sibling Set ID for the the group of volumes sharing networking resources. - public Guid? NetworkSiblingSetId { get; } + public string NetworkSiblingSetId { get; } + /// Provides storage to network proximity information for the volume. - public NetAppVolumeStorageToNetworkProximity? StorageToNetworkProximity { get; } + public VolumeStorageToNetworkProximity? StorageToNetworkProximity { get; } + /// List of mount targets. - public IReadOnlyList MountTargets { get; } + public IReadOnlyList MountTargets { get; } = new ChangeTrackingList(); + /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. For creating clone volume, set type to ShortTermClone. public string VolumeType { get; set; } + /// DataProtection type volumes include an object containing details of the replication. - public NetAppVolumeDataProtection DataProtection { get; set; } + public VolumePropertiesDataProtection DataProtection { get; set; } + /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. public AcceptGrowCapacityPoolForShortTermCloneSplit? AcceptGrowCapacityPoolForShortTermCloneSplit { get; set; } + + /// Restoring. + public bool? IsRestoring { get; } + /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - public bool? IsSnapshotDirectoryVisible { get; set; } + public bool? SnapshotDirectoryVisible { get; set; } + /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - public bool? IsKerberosEnabled { get; set; } + public bool? KerberosEnabled { get; set; } + /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - public NetAppVolumeSecurityStyle? SecurityStyle { get; set; } + public SecurityStyle? SecurityStyle { get; set; } + /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - public bool? IsSmbEncryptionEnabled { get; set; } + public bool? SmbEncryption { get; set; } + /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. public SmbAccessBasedEnumeration? SmbAccessBasedEnumeration { get; set; } + /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. public SmbNonBrowsable? SmbNonBrowsable { get; set; } + /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - public bool? IsSmbContinuouslyAvailable { get; set; } + public bool? SmbContinuouslyAvailable { get; set; } + /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. public float? ThroughputMibps { get; set; } + /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. public float? ActualThroughputMibps { get; } + /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - public NetAppEncryptionKeySource? EncryptionKeySource { get; set; } + public EncryptionKeySource? EncryptionKeySource { get; set; } + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - public ResourceIdentifier KeyVaultPrivateEndpointResourceId { get; set; } + public string KeyVaultPrivateEndpointResourceId { get; set; } + /// Specifies whether LDAP is enabled or not for a given NFS volume. - public bool? IsLdapEnabled { get; set; } + public bool? LdapEnabled { get; set; } + /// Specifies the type of LDAP server for a given NFS volume. public LdapServerType? LdapServerType { get; set; } + /// Specifies whether Cool Access(tiering) is enabled for the volume. - public bool? IsCoolAccessEnabled { get; set; } + public bool? CoolAccess { get; set; } + /// Specifies the number of days after which data that is not accessed by clients will be tiered. public int? CoolnessPeriod { get; set; } + /// /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. /// public CoolAccessRetrievalPolicy? CoolAccessRetrievalPolicy { get; set; } + /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. public CoolAccessTieringPolicy? CoolAccessTieringPolicy { get; set; } - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. Avoid passing null value for unixPermissions in volume update operation, As per the behavior, If Null value is passed then user-visible unixPermissions value will became null, and user will not be able to get unixPermissions value. On safer side, actual unixPermissions value on volume will remain as its last saved value only. + + /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. public string UnixPermissions { get; set; } + /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. public int? CloneProgress { get; } + /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - public NetAppFileAccessLog? FileAccessLogs { get; } + public FileAccessLogs? FileAccessLogs { get; } + /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - public NetAppAvsDataStore? AvsDataStore { get; set; } + public AvsDataStore? AvsDataStore { get; set; } + /// Data store resource unique identifier. - public IReadOnlyList DataStoreResourceId { get; } + public IReadOnlyList DataStoreResourceId { get; } = new ChangeTrackingList(); + /// Specifies if default quota is enabled for the volume. public bool? IsDefaultQuotaEnabled { get; set; } + /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . public long? DefaultUserQuotaInKiBs { get; set; } + /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. public long? DefaultGroupQuotaInKiBs { get; set; } + /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. public long? MaximumNumberOfFiles { get; } + /// Volume Group Name. public string VolumeGroupName { get; } + /// Pool Resource Id used in case of creating a volume through volume group. - public ResourceIdentifier CapacityPoolResourceId { get; set; } + public string CapacityPoolResourceId { get; set; } + /// Proximity placement group associated with the volume. - public ResourceIdentifier ProximityPlacementGroupId { get; set; } + public string ProximityPlacementGroup { get; set; } + /// T2 network information. public string T2Network { get; } + /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. public string VolumeSpecName { get; set; } + /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - public bool? IsEncrypted { get; } + public bool? Encrypted { get; } + /// Application specific placement rules for the particular volume. - public IList PlacementRules { get; } + public IList PlacementRules { get; } = new ChangeTrackingList(); + /// Flag indicating whether subvolume operations are enabled on the volume. - public EnableNetAppSubvolume? EnableSubvolumes { get; set; } + public EnableSubvolumes? EnableSubvolumes { get; set; } + /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. public string ProvisionedAvailabilityZone { get; } + /// Specifies whether volume is a Large Volume or Regular Volume. public bool? IsLargeVolume { get; set; } + + /// + /// Specifies the type of the Large Volume. When set to 'LargeVolume', the large volume is created with standard configuration. + /// If it is set to 'ExtraLargeVolume7Dot2PiB', the extra large volume is created with higher capacity limit 7.2PiB with cool access enabled, + /// delivering higher capacity limit with lower costs. + /// + public LargeVolumeType? LargeVolumeType { get; set; } + /// Id of the snapshot or backup that the volume is restored from. - public ResourceIdentifier OriginatingResourceId { get; } + public string OriginatingResourceId { get; } + /// Space shared by short term clone volume with parent volume in bytes. public long? InheritedSizeInBytes { get; } + /// Language supported for volume. - public NetAppVolumeLanguage? Language { get; set; } + public VolumeLanguage? Language { get; set; } + + /// Specifies whether the volume operates in Breakthrough Mode. + public BreakthroughMode? BreakthroughMode { get; set; } + + /// Export policy rule. + public IList ExportRules { get; } = new ChangeTrackingList(); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesDataProtection.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesDataProtection.Serialization.cs new file mode 100644 index 000000000000..368ba78d63be --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesDataProtection.Serialization.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// DataProtection type volumes include an object containing details of the replication. + public partial class VolumePropertiesDataProtection : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumePropertiesDataProtection)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Backup)) + { + writer.WritePropertyName("backup"u8); + writer.WriteObjectValue(Backup, options); + } + if (Optional.IsDefined(Replication)) + { + writer.WritePropertyName("replication"u8); + writer.WriteObjectValue(Replication, options); + } + if (Optional.IsDefined(Snapshot)) + { + writer.WritePropertyName("snapshot"u8); + writer.WriteObjectValue(Snapshot, options); + } + if (Optional.IsDefined(VolumeRelocation)) + { + writer.WritePropertyName("volumeRelocation"u8); + writer.WriteObjectValue(VolumeRelocation, options); + } + if (Optional.IsDefined(RansomwareProtection)) + { + writer.WritePropertyName("ransomwareProtection"u8); + writer.WriteObjectValue(RansomwareProtection, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumePropertiesDataProtection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumePropertiesDataProtection JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumePropertiesDataProtection)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumePropertiesDataProtection(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumePropertiesDataProtection DeserializeVolumePropertiesDataProtection(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + VolumeBackupProperties backup = default; + ReplicationObject replication = default; + VolumeSnapshotProperties snapshot = default; + VolumeRelocationProperties volumeRelocation = default; + RansomwareProtectionSettings ransomwareProtection = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("backup"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + backup = VolumeBackupProperties.DeserializeVolumeBackupProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("replication"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replication = ReplicationObject.DeserializeReplicationObject(prop.Value, options); + continue; + } + if (prop.NameEquals("snapshot"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshot = VolumeSnapshotProperties.DeserializeVolumeSnapshotProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("volumeRelocation"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + volumeRelocation = VolumeRelocationProperties.DeserializeVolumeRelocationProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("ransomwareProtection"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ransomwareProtection = RansomwareProtectionSettings.DeserializeRansomwareProtectionSettings(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumePropertiesDataProtection( + backup, + replication, + snapshot, + volumeRelocation, + ransomwareProtection, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumePropertiesDataProtection)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumePropertiesDataProtection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumePropertiesDataProtection PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumePropertiesDataProtection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumePropertiesDataProtection)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesDataProtection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesDataProtection.cs new file mode 100644 index 000000000000..263dabf70e44 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesDataProtection.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// DataProtection type volumes include an object containing details of the replication. + public partial class VolumePropertiesDataProtection + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumePropertiesDataProtection() + { + } + + /// Initializes a new instance of . + /// Backup Properties. + /// Replication properties. + /// Snapshot properties. + /// VolumeRelocation properties. + /// Advanced Ransomware Protection settings. + /// Keeps track of any properties unknown to the library. + internal VolumePropertiesDataProtection(VolumeBackupProperties backup, ReplicationObject replication, VolumeSnapshotProperties snapshot, VolumeRelocationProperties volumeRelocation, RansomwareProtectionSettings ransomwareProtection, IDictionary additionalBinaryDataProperties) + { + Backup = backup; + Replication = replication; + Snapshot = snapshot; + VolumeRelocation = volumeRelocation; + RansomwareProtection = ransomwareProtection; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Backup Properties. + public VolumeBackupProperties Backup { get; set; } + + /// Replication properties. + public ReplicationObject Replication { get; set; } + + /// Snapshot properties. + internal VolumeSnapshotProperties Snapshot { get; set; } + + /// VolumeRelocation properties. + public VolumeRelocationProperties VolumeRelocation { get; set; } + + /// Advanced Ransomware Protection settings. + public RansomwareProtectionSettings RansomwareProtection { get; set; } + + /// Snapshot Policy ResourceId. + public string SnapshotPolicyId + { + get + { + return Snapshot is null ? default : Snapshot.SnapshotPolicyId; + } + set + { + if (Snapshot is null) + { + Snapshot = new VolumeSnapshotProperties(); + } + Snapshot.SnapshotPolicyId = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesExportPolicy.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesExportPolicy.Serialization.cs deleted file mode 100644 index dd4ca9df646d..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesExportPolicy.Serialization.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.NetApp.Models -{ - internal partial class VolumePropertiesExportPolicy : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(VolumePropertiesExportPolicy)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Rules)) - { - writer.WritePropertyName("rules"u8); - writer.WriteStartArray(); - foreach (var item in Rules) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - VolumePropertiesExportPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(VolumePropertiesExportPolicy)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeVolumePropertiesExportPolicy(document.RootElement, options); - } - - internal static VolumePropertiesExportPolicy DeserializeVolumePropertiesExportPolicy(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList rules = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("rules"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(NetAppVolumeExportPolicyRule.DeserializeNetAppVolumeExportPolicyRule(item, options)); - } - rules = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new VolumePropertiesExportPolicy(rules ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(VolumePropertiesExportPolicy)} does not support writing '{options.Format}' format."); - } - } - - VolumePropertiesExportPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeVolumePropertiesExportPolicy(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(VolumePropertiesExportPolicy)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesExportPolicy.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesExportPolicy.cs deleted file mode 100644 index c47c8150a4fc..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumePropertiesExportPolicy.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.NetApp.Models -{ - /// Set of export policy rules. - internal partial class VolumePropertiesExportPolicy - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public VolumePropertiesExportPolicy() - { - Rules = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Export policy rule. - /// Keeps track of any properties unknown to the library. - internal VolumePropertiesExportPolicy(IList rules, IDictionary serializedAdditionalRawData) - { - Rules = rules; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Export policy rule. - public IList Rules { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulePatch.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulePatch.Serialization.cs new file mode 100644 index 000000000000..7b95bb90178d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulePatch.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Patchable Quota Rule of a Volume. + public partial class VolumeQuotaRulePatch : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeQuotaRulePatch)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeQuotaRulePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeQuotaRulePatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeQuotaRulePatch)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeQuotaRulePatch(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeQuotaRulePatch DeserializeVolumeQuotaRulePatch(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + VolumeQuotaRulesProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = VolumeQuotaRulesProperties.DeserializeVolumeQuotaRulesProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeQuotaRulePatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeQuotaRulePatch)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeQuotaRulePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeQuotaRulePatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeQuotaRulePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeQuotaRulePatch)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(VolumeQuotaRulePatch volumeQuotaRulePatch) + { + if (volumeQuotaRulePatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(volumeQuotaRulePatch, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulePatch.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulePatch.cs new file mode 100644 index 000000000000..2624820244d7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulePatch.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Patchable Quota Rule of a Volume. + public partial class VolumeQuotaRulePatch + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumeQuotaRulePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// Volume Quota Rule Properties. + /// Keeps track of any properties unknown to the library. + internal VolumeQuotaRulePatch(IDictionary tags, VolumeQuotaRulesProperties properties, IDictionary additionalBinaryDataProperties) + { + Tags = tags; + Properties = properties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource tags. + public IDictionary Tags { get; } + + /// Volume Quota Rule Properties. + internal VolumeQuotaRulesProperties Properties { get; set; } + + /// Gets the status of the VolumeQuotaRule at the time the operation was called. + public Models.NetAppProvisioningState? ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Size of quota. + public long? QuotaSizeInKiBs + { + get + { + return Properties is null ? default : Properties.QuotaSizeInKiBs; + } + set + { + if (Properties is null) + { + Properties = new VolumeQuotaRulesProperties(); + } + Properties.QuotaSizeInKiBs = value.Value; + } + } + + /// Type of quota. + public Type? QuotaType + { + get + { + return Properties is null ? default : Properties.QuotaType; + } + set + { + if (Properties is null) + { + Properties = new VolumeQuotaRulesProperties(); + } + Properties.QuotaType = value.Value; + } + } + + /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. + public string QuotaTarget + { + get + { + return Properties is null ? default : Properties.QuotaTarget; + } + set + { + if (Properties is null) + { + Properties = new VolumeQuotaRulesProperties(); + } + Properties.QuotaTarget = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesList.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesList.Serialization.cs index 57e04c21010e..6e28db3237cc 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesList.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesList.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class VolumeQuotaRulesList : IUtf8JsonSerializable, IJsonModel + /// List of Volume Quota Rules. + internal partial class VolumeQuotaRulesList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal VolumeQuotaRulesList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VolumeQuotaRulesList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (VolumeQuotaRuleData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -61,58 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VolumeQuotaRulesList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + VolumeQuotaRulesList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeQuotaRulesList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VolumeQuotaRulesList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeVolumeQuotaRulesList(document.RootElement, options); } - internal static VolumeQuotaRulesList DeserializeVolumeQuotaRulesList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeQuotaRulesList DeserializeVolumeQuotaRulesList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - continue; + array.Add(VolumeQuotaRuleData.DeserializeVolumeQuotaRuleData(item, options)); } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { - array.Add(NetAppVolumeQuotaRuleData.DeserializeNetAppVolumeQuotaRuleData(item, options)); + continue; } - value = array; + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new VolumeQuotaRulesList(value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new VolumeQuotaRulesList(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -122,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption } } - VolumeQuotaRulesList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + VolumeQuotaRulesList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeQuotaRulesList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeVolumeQuotaRulesList(document.RootElement, options); } default: @@ -138,6 +163,15 @@ VolumeQuotaRulesList IPersistableModel.Create(BinaryData d } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static VolumeQuotaRulesList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeVolumeQuotaRulesList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesList.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesList.cs index f6f8835cf9e9..5e554afc14d7 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesList.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesList.cs @@ -7,60 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { /// List of Volume Quota Rules. internal partial class VolumeQuotaRulesList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal VolumeQuotaRulesList() + /// The VolumeQuotaRule items on this page. + internal VolumeQuotaRulesList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// A list of Volume Quota Rules. - /// Keeps track of any properties unknown to the library. - internal VolumeQuotaRulesList(IReadOnlyList value, IDictionary serializedAdditionalRawData) + /// The VolumeQuotaRule items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal VolumeQuotaRulesList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// A list of Volume Quota Rules. - public IReadOnlyList Value { get; } + /// The VolumeQuotaRule items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesProperties.Serialization.cs new file mode 100644 index 000000000000..b8396bb2b63a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesProperties.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume Quota Rule properties. + internal partial class VolumeQuotaRulesProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeQuotaRulesProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(QuotaSizeInKiBs)) + { + writer.WritePropertyName("quotaSizeInKiBs"u8); + writer.WriteNumberValue(QuotaSizeInKiBs.Value); + } + if (Optional.IsDefined(QuotaType)) + { + writer.WritePropertyName("quotaType"u8); + writer.WriteStringValue(QuotaType.Value.ToString()); + } + if (Optional.IsDefined(QuotaTarget)) + { + writer.WritePropertyName("quotaTarget"u8); + writer.WriteStringValue(QuotaTarget); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeQuotaRulesProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeQuotaRulesProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeQuotaRulesProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeQuotaRulesProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeQuotaRulesProperties DeserializeVolumeQuotaRulesProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Models.NetAppProvisioningState? provisioningState = default; + long? quotaSizeInKiBs = default; + Type? quotaType = default; + string quotaTarget = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new Models.NetAppProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("quotaSizeInKiBs"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quotaSizeInKiBs = prop.Value.GetInt64(); + continue; + } + if (prop.NameEquals("quotaType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + quotaType = new Type(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("quotaTarget"u8)) + { + quotaTarget = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeQuotaRulesProperties(provisioningState, quotaSizeInKiBs, quotaType, quotaTarget, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeQuotaRulesProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeQuotaRulesProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeQuotaRulesProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeQuotaRulesProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeQuotaRulesProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesProperties.cs new file mode 100644 index 000000000000..4a2d3d095631 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeQuotaRulesProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume Quota Rule properties. + internal partial class VolumeQuotaRulesProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumeQuotaRulesProperties() + { + } + + /// Initializes a new instance of . + /// Gets the status of the VolumeQuotaRule at the time the operation was called. + /// Size of quota. + /// Type of quota. + /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. + /// Keeps track of any properties unknown to the library. + internal VolumeQuotaRulesProperties(Models.NetAppProvisioningState? provisioningState, long? quotaSizeInKiBs, Type? quotaType, string quotaTarget, IDictionary additionalBinaryDataProperties) + { + ProvisioningState = provisioningState; + QuotaSizeInKiBs = quotaSizeInKiBs; + QuotaType = quotaType; + QuotaTarget = quotaTarget; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Gets the status of the VolumeQuotaRule at the time the operation was called. + public Models.NetAppProvisioningState? ProvisioningState { get; } + + /// Size of quota. + public long? QuotaSizeInKiBs { get; set; } + + /// Type of quota. + public Type? QuotaType { get; set; } + + /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. + public string QuotaTarget { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRelocationProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRelocationProperties.Serialization.cs new file mode 100644 index 000000000000..a87f0b8b81e2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRelocationProperties.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume relocation properties. + public partial class VolumeRelocationProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeRelocationProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(RelocationRequested)) + { + writer.WritePropertyName("relocationRequested"u8); + writer.WriteBooleanValue(RelocationRequested.Value); + } + if (options.Format != "W" && Optional.IsDefined(ReadyToBeFinalized)) + { + writer.WritePropertyName("readyToBeFinalized"u8); + writer.WriteBooleanValue(ReadyToBeFinalized.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeRelocationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeRelocationProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeRelocationProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeRelocationProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeRelocationProperties DeserializeVolumeRelocationProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? relocationRequested = default; + bool? readyToBeFinalized = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("relocationRequested"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + relocationRequested = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("readyToBeFinalized"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readyToBeFinalized = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeRelocationProperties(relocationRequested, readyToBeFinalized, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeRelocationProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeRelocationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeRelocationProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeRelocationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeRelocationProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRelocationProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRelocationProperties.cs new file mode 100644 index 000000000000..1a1fa7f29a78 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRelocationProperties.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume relocation properties. + public partial class VolumeRelocationProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumeRelocationProperties() + { + } + + /// Initializes a new instance of . + /// Has relocation been requested for this volume. + /// Has relocation finished and is ready to be cleaned up. + /// Keeps track of any properties unknown to the library. + internal VolumeRelocationProperties(bool? relocationRequested, bool? readyToBeFinalized, IDictionary additionalBinaryDataProperties) + { + RelocationRequested = relocationRequested; + ReadyToBeFinalized = readyToBeFinalized; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Has relocation been requested for this volume. + public bool? RelocationRequested { get; set; } + + /// Has relocation finished and is ready to be cleaned up. + public bool? ReadyToBeFinalized { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeReplicationRelationshipStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeReplicationRelationshipStatus.cs index f4730bdea6b2..d221dc3374c3 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeReplicationRelationshipStatus.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeReplicationRelationshipStatus.cs @@ -7,45 +7,63 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - /// Status of the mirror relationship. + /// Status of the volume replication relationship. public readonly partial struct VolumeReplicationRelationshipStatus : IEquatable { private readonly string _value; + private const string IdleValue = "Idle"; + private const string TransferringValue = "Transferring"; /// Initializes a new instance of . + /// The value. /// is null. public VolumeReplicationRelationshipStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string IdleValue = "Idle"; - private const string TransferringValue = "Transferring"; + _value = value; + } - /// Idle. + /// Gets the Idle. public static VolumeReplicationRelationshipStatus Idle { get; } = new VolumeReplicationRelationshipStatus(IdleValue); - /// Transferring. + + /// Gets the Transferring. public static VolumeReplicationRelationshipStatus Transferring { get; } = new VolumeReplicationRelationshipStatus(TransferringValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(VolumeReplicationRelationshipStatus left, VolumeReplicationRelationshipStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(VolumeReplicationRelationshipStatus left, VolumeReplicationRelationshipStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator VolumeReplicationRelationshipStatus(string value) => new VolumeReplicationRelationshipStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator VolumeReplicationRelationshipStatus?(string value) => value == null ? null : new VolumeReplicationRelationshipStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is VolumeReplicationRelationshipStatus other && Equals(other); - /// + + /// public bool Equals(VolumeReplicationRelationshipStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRestoreRelationshipStatus.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRestoreRelationshipStatus.cs new file mode 100644 index 000000000000..137475fc0e03 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRestoreRelationshipStatus.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Status of the volume restore relationship. + public readonly partial struct VolumeRestoreRelationshipStatus : IEquatable + { + private readonly string _value; + private const string IdleValue = "Idle"; + private const string TransferringValue = "Transferring"; + private const string FailedValue = "Failed"; + private const string UnknownValue = "Unknown"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public VolumeRestoreRelationshipStatus(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Idle. + public static VolumeRestoreRelationshipStatus Idle { get; } = new VolumeRestoreRelationshipStatus(IdleValue); + + /// Gets the Transferring. + public static VolumeRestoreRelationshipStatus Transferring { get; } = new VolumeRestoreRelationshipStatus(TransferringValue); + + /// Gets the Failed. + public static VolumeRestoreRelationshipStatus Failed { get; } = new VolumeRestoreRelationshipStatus(FailedValue); + + /// Gets the Unknown. + public static VolumeRestoreRelationshipStatus Unknown { get; } = new VolumeRestoreRelationshipStatus(UnknownValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(VolumeRestoreRelationshipStatus left, VolumeRestoreRelationshipStatus right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(VolumeRestoreRelationshipStatus left, VolumeRestoreRelationshipStatus right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator VolumeRestoreRelationshipStatus(string value) => new VolumeRestoreRelationshipStatus(value); + + /// Converts a string to a . + /// The value. + public static implicit operator VolumeRestoreRelationshipStatus?(string value) => value == null ? null : new VolumeRestoreRelationshipStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VolumeRestoreRelationshipStatus other && Equals(other); + + /// + public bool Equals(VolumeRestoreRelationshipStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRevert.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRevert.Serialization.cs new file mode 100644 index 000000000000..9e19aafb6487 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRevert.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// revert a volume to the snapshot. + public partial class VolumeRevert : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeRevert)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotId)) + { + writer.WritePropertyName("snapshotId"u8); + writer.WriteStringValue(SnapshotId); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeRevert IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeRevert JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeRevert)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeRevert(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeRevert DeserializeVolumeRevert(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier snapshotId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeRevert(snapshotId, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeRevert)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeRevert IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeRevert PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeRevert(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeRevert)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(VolumeRevert volumeRevert) + { + if (volumeRevert == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(volumeRevert, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRevert.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRevert.cs new file mode 100644 index 000000000000..44ba7bb32bb7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeRevert.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// revert a volume to the snapshot. + public partial class VolumeRevert + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumeRevert() + { + } + + /// Initializes a new instance of . + /// Resource id of the snapshot. + /// Keeps track of any properties unknown to the library. + internal VolumeRevert(ResourceIdentifier snapshotId, IDictionary additionalBinaryDataProperties) + { + SnapshotId = snapshotId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Resource id of the snapshot. + public ResourceIdentifier SnapshotId { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSize.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSize.cs new file mode 100644 index 000000000000..bebcf572d2a6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSize.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Volume size for backup. + public readonly partial struct VolumeSize : IEquatable + { + private readonly string _value; + /// Value indicating backup is for a large volume. + private const string LargeValue = "Large"; + /// Value indicating backup is not for a large volume. + private const string RegularValue = "Regular"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public VolumeSize(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Value indicating backup is for a large volume. + public static VolumeSize Large { get; } = new VolumeSize(LargeValue); + + /// Value indicating backup is not for a large volume. + public static VolumeSize Regular { get; } = new VolumeSize(RegularValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(VolumeSize left, VolumeSize right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(VolumeSize left, VolumeSize right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator VolumeSize(string value) => new VolumeSize(value); + + /// Converts a string to a . + /// The value. + public static implicit operator VolumeSize?(string value) => value == null ? null : new VolumeSize(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VolumeSize other && Equals(other); + + /// + public bool Equals(VolumeSize other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.Serialization.cs index 90f604a24361..526e6e7cdb49 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.NetApp; namespace Azure.ResourceManager.NetApp.Models { - internal partial class VolumeSnapshotProperties : IUtf8JsonSerializable, IJsonModel + /// Volume Snapshot Properties. + internal partial class VolumeSnapshotProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +29,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VolumeSnapshotProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(SnapshotPolicyId)) { writer.WritePropertyName("snapshotPolicyId"u8); writer.WriteStringValue(SnapshotPolicyId); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -56,53 +56,55 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VolumeSnapshotProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + VolumeSnapshotProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VolumeSnapshotProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VolumeSnapshotProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeVolumeSnapshotProperties(document.RootElement, options); } - internal static VolumeSnapshotProperties DeserializeVolumeSnapshotProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeSnapshotProperties DeserializeVolumeSnapshotProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - ResourceIdentifier snapshotPolicyId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + string snapshotPolicyId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("snapshotPolicyId"u8)) + if (prop.NameEquals("snapshotPolicyId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null || property.Value.ValueKind == JsonValueKind.String && property.Value.GetString().Length == 0) - { - continue; - } - snapshotPolicyId = new ResourceIdentifier(property.Value.GetString()); + snapshotPolicyId = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new VolumeSnapshotProperties(snapshotPolicyId, serializedAdditionalRawData); + return new VolumeSnapshotProperties(snapshotPolicyId, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -112,15 +114,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - VolumeSnapshotProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + VolumeSnapshotProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VolumeSnapshotProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeVolumeSnapshotProperties(document.RootElement, options); } default: @@ -128,6 +135,7 @@ VolumeSnapshotProperties IPersistableModel.Create(Bina } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.cs index 8e0cf23331b8..7f4ea0463c02 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeSnapshotProperties.cs @@ -7,44 +7,14 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.NetApp.Models { /// Volume Snapshot Properties. internal partial class VolumeSnapshotProperties { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public VolumeSnapshotProperties() @@ -53,14 +23,14 @@ public VolumeSnapshotProperties() /// Initializes a new instance of . /// Snapshot Policy ResourceId. - /// Keeps track of any properties unknown to the library. - internal VolumeSnapshotProperties(ResourceIdentifier snapshotPolicyId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal VolumeSnapshotProperties(string snapshotPolicyId, IDictionary additionalBinaryDataProperties) { SnapshotPolicyId = snapshotPolicyId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Snapshot Policy ResourceId. - public ResourceIdentifier SnapshotPolicyId { get; set; } + public string SnapshotPolicyId { get; set; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeStorageToNetworkProximity.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeStorageToNetworkProximity.cs new file mode 100644 index 000000000000..6fa9dc37c26d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/VolumeStorageToNetworkProximity.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Provides storage to network proximity information for the volume. + public readonly partial struct VolumeStorageToNetworkProximity : IEquatable + { + private readonly string _value; + /// Basic storage to network connectivity. + private const string DefaultValue = "Default"; + /// Standard T1 storage to network connectivity. + private const string T1Value = "T1"; + /// Standard T2 storage to network connectivity. + private const string T2Value = "T2"; + /// Standard AcrossT2 storage to network connectivity. + private const string AcrossT2Value = "AcrossT2"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public VolumeStorageToNetworkProximity(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Basic storage to network connectivity. + public static VolumeStorageToNetworkProximity Default { get; } = new VolumeStorageToNetworkProximity(DefaultValue); + + /// Standard T1 storage to network connectivity. + public static VolumeStorageToNetworkProximity T1 { get; } = new VolumeStorageToNetworkProximity(T1Value); + + /// Standard T2 storage to network connectivity. + public static VolumeStorageToNetworkProximity T2 { get; } = new VolumeStorageToNetworkProximity(T2Value); + + /// Standard AcrossT2 storage to network connectivity. + public static VolumeStorageToNetworkProximity AcrossT2 { get; } = new VolumeStorageToNetworkProximity(AcrossT2Value); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(VolumeStorageToNetworkProximity left, VolumeStorageToNetworkProximity right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(VolumeStorageToNetworkProximity left, VolumeStorageToNetworkProximity right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator VolumeStorageToNetworkProximity(string value) => new VolumeStorageToNetworkProximity(value); + + /// Converts a string to a . + /// The value. + public static implicit operator VolumeStorageToNetworkProximity?(string value) => value == null ? null : new VolumeStorageToNetworkProximity(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VolumeStorageToNetworkProximity other && Equals(other); + + /// + public bool Equals(VolumeStorageToNetworkProximity other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/WeeklySchedule.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/WeeklySchedule.Serialization.cs new file mode 100644 index 000000000000..fc49e15fd00e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/WeeklySchedule.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.NetApp; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Weekly Schedule properties, make a snapshot every week at a specific day or days. + public partial class WeeklySchedule : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WeeklySchedule)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(SnapshotsToKeep)) + { + writer.WritePropertyName("snapshotsToKeep"u8); + writer.WriteNumberValue(SnapshotsToKeep.Value); + } + if (Optional.IsDefined(Day)) + { + writer.WritePropertyName("day"u8); + writer.WriteStringValue(Day); + } + if (Optional.IsDefined(Hour)) + { + writer.WritePropertyName("hour"u8); + writer.WriteNumberValue(Hour.Value); + } + if (Optional.IsDefined(Minute)) + { + writer.WritePropertyName("minute"u8); + writer.WriteNumberValue(Minute.Value); + } + if (Optional.IsDefined(UsedBytes)) + { + writer.WritePropertyName("usedBytes"u8); + writer.WriteNumberValue(UsedBytes.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + WeeklySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual WeeklySchedule JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WeeklySchedule)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWeeklySchedule(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static WeeklySchedule DeserializeWeeklySchedule(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? snapshotsToKeep = default; + string day = default; + int? hour = default; + int? minute = default; + long? usedBytes = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("snapshotsToKeep"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + snapshotsToKeep = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("day"u8)) + { + day = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("hour"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hour = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("minute"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minute = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("usedBytes"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usedBytes = prop.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new WeeklySchedule( + snapshotsToKeep, + day, + hour, + minute, + usedBytes, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(WeeklySchedule)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + WeeklySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual WeeklySchedule PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeWeeklySchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WeeklySchedule)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/WeeklySchedule.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/WeeklySchedule.cs new file mode 100644 index 000000000000..0dd2c0ac53b8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/Models/WeeklySchedule.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NetApp.Models +{ + /// Weekly Schedule properties, make a snapshot every week at a specific day or days. + public partial class WeeklySchedule + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public WeeklySchedule() + { + } + + /// Initializes a new instance of . + /// Weekly snapshot count to keep. + /// Indicates which weekdays snapshot should be taken, accepts a comma separated list of week day names in english. + /// Indicates which hour in UTC timezone a snapshot should be taken. + /// Indicates which minute snapshot should be taken. + /// Resource size in bytes, current storage usage for the volume in bytes. + /// Keeps track of any properties unknown to the library. + internal WeeklySchedule(int? snapshotsToKeep, string day, int? hour, int? minute, long? usedBytes, IDictionary additionalBinaryDataProperties) + { + SnapshotsToKeep = snapshotsToKeep; + Day = day; + Hour = hour; + Minute = minute; + UsedBytes = usedBytes; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Weekly snapshot count to keep. + public int? SnapshotsToKeep { get; set; } + + /// Indicates which weekdays snapshot should be taken, accepts a comma separated list of week day names in english. + public string Day { get; set; } + + /// Indicates which hour in UTC timezone a snapshot should be taken. + public int? Hour { get; set; } + + /// Indicates which minute snapshot should be taken. + public int? Minute { get; set; } + + /// Resource size in bytes, current storage usage for the volume in bytes. + public long? UsedBytes { get; set; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountCollection.cs index 6b0ff0a094ac..c11362c0a512 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountCollection.cs @@ -8,68 +8,75 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NetApp { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNetAppAccounts method from an instance of . + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetNetAppAccounts method from an instance of the parent resource. /// public partial class NetAppAccountCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _netAppAccountAccountsClientDiagnostics; - private readonly AccountsRestOperations _netAppAccountAccountsRestClient; + private readonly ClientDiagnostics _volumeGroupsClientDiagnostics; + private readonly VolumeGroups _volumeGroupsRestClient; + private readonly ClientDiagnostics _accountsClientDiagnostics; + private readonly Accounts _accountsRestClient; + private readonly ClientDiagnostics _backupsUnderAccountClientDiagnostics; + private readonly BackupsUnderAccount _backupsUnderAccountRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of NetAppAccountCollection for mocking. protected NetAppAccountCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal NetAppAccountCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _netAppAccountAccountsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppAccountResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppAccountResource.ResourceType, out string netAppAccountAccountsApiVersion); - _netAppAccountAccountsRestClient = new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppAccountAccountsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(NetAppAccountResource.ResourceType, out string netAppAccountApiVersion); + _volumeGroupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppAccountResource.ResourceType.Namespace, Diagnostics); + _volumeGroupsRestClient = new VolumeGroups(_volumeGroupsClientDiagnostics, Pipeline, Endpoint, netAppAccountApiVersion ?? "2025-09-01-preview"); + _accountsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppAccountResource.ResourceType.Namespace, Diagnostics); + _accountsRestClient = new Accounts(_accountsClientDiagnostics, Pipeline, Endpoint, netAppAccountApiVersion ?? "2025-09-01-preview"); + _backupsUnderAccountClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppAccountResource.ResourceType.Namespace, Diagnostics); + _backupsUnderAccountRestClient = new BackupsUnderAccount(_backupsUnderAccountClientDiagnostics, Pipeline, Endpoint, netAppAccountApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } } /// /// Create or update the specified NetApp account within the resource group /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Operation Id - /// Accounts_CreateOrUpdate + /// Operation Id. + /// NetAppAccounts_CreateOrUpdate. /// /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// @@ -77,21 +84,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the NetApp account. /// NetApp Account object supplied in the body of the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string accountName, NetAppAccountData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountCollection.CreateOrUpdate"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _netAppAccountAccountsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppAccountOperationSource(Client), _netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, accountName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, NetAppAccountData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new NetAppAccountOperationSource(Client), + _accountsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -105,20 +125,16 @@ public virtual async Task> CreateOrUpdateAsy /// Create or update the specified NetApp account within the resource group /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// NetAppAccounts_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// @@ -126,21 +142,34 @@ public virtual async Task> CreateOrUpdateAsy /// The name of the NetApp account. /// NetApp Account object supplied in the body of the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string accountName, NetAppAccountData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountCollection.CreateOrUpdate"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountCollection.CreateOrUpdate"); scope.Start(); try { - var response = _netAppAccountAccountsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, accountName, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppAccountOperationSource(Client), _netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, accountName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, NetAppAccountData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new NetAppAccountOperationSource(Client), + _accountsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -154,38 +183,42 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wait /// Get the NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// NetAppAccounts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the NetApp account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountCollection.Get"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountCollection.Get"); scope.Start(); try { - var response = await _netAppAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetAppAccountData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,38 +232,42 @@ public virtual async Task> GetAsync(string accou /// Get the NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// NetAppAccounts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the NetApp account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountCollection.Get"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountCollection.Get"); scope.Start(); try { - var response = _netAppAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetAppAccountData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -240,100 +277,78 @@ public virtual Response Get(string accountName, Cancellat } } - /// - /// List and describe all NetApp accounts in the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts - /// - /// - /// Operation Id - /// Accounts_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// List and describe all NetApp accounts in the resource group. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetAppAccountResource(Client, NetAppAccountData.DeserializeNetAppAccountData(e)), _netAppAccountAccountsClientDiagnostics, Pipeline, "NetAppAccountCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new AccountsGetAllAsyncCollectionResultOfT(_accountsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new NetAppAccountResource(Client, data)); } - /// - /// List and describe all NetApp accounts in the resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts - /// - /// - /// Operation Id - /// Accounts_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// List and describe all NetApp accounts in the resource group. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppAccountAccountsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppAccountAccountsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetAppAccountResource(Client, NetAppAccountData.DeserializeNetAppAccountData(e)), _netAppAccountAccountsClientDiagnostics, Pipeline, "NetAppAccountCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new AccountsGetAllCollectionResultOfT(_accountsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new NetAppAccountResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Get the NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Operation Id - /// Accounts_Get + /// Operation Id. + /// NetAppAccounts_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the NetApp account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountCollection.Exists"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountCollection.Exists"); scope.Start(); try { - var response = await _netAppAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(NetAppAccountData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((NetAppAccountData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -344,39 +359,53 @@ public virtual async Task> ExistsAsync(string accountName, Cancel } /// - /// Checks to see if the resource exists in azure. + /// Get the NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// NetAppAccounts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the NetApp account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountCollection.Exists"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountCollection.Exists"); scope.Start(); try { - var response = _netAppAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(NetAppAccountData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((NetAppAccountData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -387,41 +416,57 @@ public virtual Response Exists(string accountName, CancellationToken cance } /// - /// Tries to get details for this resource from the service. + /// Get the NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// NetAppAccounts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the NetApp account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountCollection.GetIfExists"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountCollection.GetIfExists"); scope.Start(); try { - var response = await _netAppAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(NetAppAccountData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((NetAppAccountData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -432,41 +477,57 @@ public virtual async Task> GetIfExistsAs } /// - /// Tries to get details for this resource from the service. + /// Get the NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// NetAppAccounts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the NetApp account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountCollection.GetIfExists"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountCollection.GetIfExists"); scope.Start(); try { - var response = _netAppAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, accountName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(NetAppAccountData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((NetAppAccountData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -486,6 +547,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountData.Serialization.cs index bfccdcb33ad8..fe26c05eda27 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountData.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountData.Serialization.cs @@ -10,16 +10,23 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - public partial class NetAppAccountData : IUtf8JsonSerializable, IJsonModel + /// NetApp account resource. + public partial class NetAppAccountData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal NetAppAccountData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,289 +38,172 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppAccountData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); - writer.WriteStringValue(ETag.Value.ToString()); + writer.WriteStringValue(ETag); } if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - ((IJsonModel)Identity).Write(writer, ModelSerializationExtensions.WireV3Options); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsCollectionDefined(ActiveDirectories)) - { - writer.WritePropertyName("activeDirectories"u8); - writer.WriteStartArray(); - foreach (var item in ActiveDirectories) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(Encryption)) - { - writer.WritePropertyName("encryption"u8); - writer.WriteObjectValue(Encryption, options); - } - if (options.Format != "W" && Optional.IsDefined(DisableShowmount)) - { - if (DisableShowmount != null) - { - writer.WritePropertyName("disableShowmount"u8); - writer.WriteBooleanValue(DisableShowmount.Value); - } - else - { - writer.WriteNull("disableShowmount"); - } - } - if (Optional.IsDefined(NfsV4IdDomain)) - { - if (NfsV4IdDomain != null) - { - writer.WritePropertyName("nfsV4IDDomain"u8); - writer.WriteStringValue(NfsV4IdDomain); - } - else - { - writer.WriteNull("nfsV4IDDomain"); - } - } - if (options.Format != "W" && Optional.IsDefined(MultiAdStatus)) - { - writer.WritePropertyName("multiAdStatus"u8); - writer.WriteStringValue(MultiAdStatus.Value.ToString()); + ((IJsonModel)Identity).Write(writer, options); } - if (Optional.IsDefined(LdapConfiguration)) - { - writer.WritePropertyName("ldapConfiguration"u8); - writer.WriteObjectValue(LdapConfiguration, options); - } - writer.WriteEndObject(); } - NetAppAccountData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + NetAppAccountData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (NetAppAccountData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(NetAppAccountData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeNetAppAccountData(document.RootElement, options); } - internal static NetAppAccountData DeserializeNetAppAccountData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NetAppAccountData DeserializeNetAppAccountData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - ETag? etag = default; - ManagedServiceIdentity identity = default; - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string provisioningState = default; - IList activeDirectories = default; - NetAppAccountEncryption encryption = default; - bool? disableShowmount = default; - string nfsV4IdDomain = default; - MultiAdStatus? multiAdStatus = default; - LdapConfiguration ldapConfiguration = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + AccountProperties properties = default; + string eTag = default; + ManagedServiceIdentity identity = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("etag"u8)) + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - etag = new ETag(property.Value.GetString()); + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("identity"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireV3Options, AzureResourceManagerNetAppContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("location"u8)) { - type = new ResourceType(property.Value.GetString()); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + properties = AccountProperties.DeserializeAccountProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("etag"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + eTag = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("identity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("activeDirectories"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(NetAppAccountActiveDirectory.DeserializeNetAppAccountActiveDirectory(item, options)); - } - activeDirectories = array; - continue; - } - if (property0.NameEquals("encryption"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - encryption = NetAppAccountEncryption.DeserializeNetAppAccountEncryption(property0.Value, options); - continue; - } - if (property0.NameEquals("disableShowmount"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - disableShowmount = null; - continue; - } - disableShowmount = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("nfsV4IDDomain"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - nfsV4IdDomain = null; - continue; - } - nfsV4IdDomain = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("multiAdStatus"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - multiAdStatus = new MultiAdStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("ldapConfiguration"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - ldapConfiguration = LdapConfiguration.DeserializeLdapConfiguration(property0.Value, options); - continue; - } - } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new NetAppAccountData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, tags ?? new ChangeTrackingDictionary(), location, - etag, - identity, - provisioningState, - activeDirectories ?? new ChangeTrackingList(), - encryption, - disableShowmount, - nfsV4IdDomain, - multiAdStatus, - ldapConfiguration, - serializedAdditionalRawData); + properties, + eTag, + identity); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -323,15 +213,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - NetAppAccountData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + NetAppAccountData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (NetAppAccountData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeNetAppAccountData(document.RootElement, options); } default: @@ -339,6 +234,27 @@ NetAppAccountData IPersistableModel.Create(BinaryData data, M } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(NetAppAccountData netAppAccountData) + { + if (netAppAccountData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(netAppAccountData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static NetAppAccountData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeNetAppAccountData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountData.cs index e607aae31709..91f6973642a1 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountData.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountData.cs @@ -13,104 +13,135 @@ namespace Azure.ResourceManager.NetApp { - /// - /// A class representing the NetAppAccount data model. - /// NetApp account resource - /// + /// NetApp account resource. public partial class NetAppAccountData : TrackedResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. + /// The geo-location where the resource lives. public NetAppAccountData(AzureLocation location) : base(location) { - ActiveDirectories = new ChangeTrackingList(); } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// The identity used for the resource. - /// Azure lifecycle management. - /// Active Directories. - /// Encryption settings. - /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. - /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. - /// MultiAD Status for the account. - /// LDAP Configuration for the account. - /// Keeps track of any properties unknown to the library. - internal NetAppAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ManagedServiceIdentity identity, string provisioningState, IList activeDirectories, NetAppAccountEncryption encryption, bool? disableShowmount, string nfsV4IdDomain, MultiAdStatus? multiAdStatus, LdapConfiguration ldapConfiguration, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// NetApp Account properties. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + /// The managed service identities assigned to this resource. + internal NetAppAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, AccountProperties properties, string eTag, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) { - ETag = etag; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; Identity = identity; - ProvisioningState = provisioningState; - ActiveDirectories = activeDirectories; - Encryption = encryption; - DisableShowmount = disableShowmount; - NfsV4IdDomain = nfsV4IdDomain; - MultiAdStatus = multiAdStatus; - LdapConfiguration = ldapConfiguration; - _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal NetAppAccountData() - { - } + /// NetApp Account properties. + internal AccountProperties Properties { get; set; } + + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + public string ETag { get; } - /// A unique read-only string that changes whenever the resource is updated. - public ETag? ETag { get; } - /// The identity used for the resource. + /// The managed service identities assigned to this resource. public ManagedServiceIdentity Identity { get; set; } + /// Azure lifecycle management. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// Active Directories. - public IList ActiveDirectories { get; } + public IList ActiveDirectories + { + get + { + if (Properties is null) + { + Properties = new AccountProperties(); + } + return Properties.ActiveDirectories; + } + } + /// Encryption settings. - public NetAppAccountEncryption Encryption { get; set; } + public AccountEncryption Encryption + { + get + { + return Properties is null ? default : Properties.Encryption; + } + set + { + if (Properties is null) + { + Properties = new AccountProperties(); + } + Properties.Encryption = value; + } + } + /// Shows the status of disableShowmount for all volumes under the subscription, null equals false. - public bool? DisableShowmount { get; } + public bool? DisableShowmount + { + get + { + return Properties is null ? default : Properties.DisableShowmount; + } + } + /// Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and only affect non ldap NFSv4 volumes. - public string NfsV4IdDomain { get; set; } + public string NfsV4IDDomain + { + get + { + return Properties is null ? default : Properties.NfsV4IDDomain; + } + set + { + if (Properties is null) + { + Properties = new AccountProperties(); + } + Properties.NfsV4IDDomain = value; + } + } + /// MultiAD Status for the account. - public MultiAdStatus? MultiAdStatus { get; } + public MultiAdStatus? MultiAdStatus + { + get + { + return Properties is null ? default : Properties.MultiAdStatus; + } + } + /// LDAP Configuration for the account. - public LdapConfiguration LdapConfiguration { get; set; } + public LdapConfiguration LdapConfiguration + { + get + { + return Properties is null ? default : Properties.LdapConfiguration; + } + set + { + if (Properties is null) + { + Properties = new AccountProperties(); + } + Properties.LdapConfiguration = value; + } + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.Serialization.cs index ffe67b233be1..a229fcc8c838 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.Serialization.cs @@ -8,22 +8,33 @@ using System; using System.ClientModel.Primitives; using System.Text.Json; +using Azure.ResourceManager; namespace Azure.ResourceManager.NetApp { - public partial class NetAppAccountResource : IJsonModel + /// + public partial class NetAppAccountResource : ArmResource, IJsonModel { - private static NetAppAccountData s_dataDeserializationInstance; - private static NetAppAccountData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new NetAppAccountData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - NetAppAccountData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + NetAppAccountData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. NetAppAccountData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs index 9029e5736872..306e7275da67 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs @@ -7,54 +7,41 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.NetApp.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NetApp { /// - /// A Class representing a NetAppAccount along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNetAppAccountResource method. - /// Otherwise you can get one from its parent resource using the GetNetAppAccount method. + /// A class representing a NetAppAccount along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetNetAppAccounts method. /// public partial class NetAppAccountResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _netAppAccountAccountsClientDiagnostics; - private readonly AccountsRestOperations _netAppAccountAccountsRestClient; - private readonly ClientDiagnostics _netAppVolumeGroupVolumeGroupsClientDiagnostics; - private readonly VolumeGroupsRestOperations _netAppVolumeGroupVolumeGroupsRestClient; - private readonly ClientDiagnostics _netAppResourceQuotaLimitsAccountClientDiagnostics; - private readonly NetAppResourceQuotaLimitsAccountRestOperations _netAppResourceQuotaLimitsAccountRestClient; + private readonly ClientDiagnostics _volumeGroupsClientDiagnostics; + private readonly VolumeGroups _volumeGroupsRestClient; + private readonly ClientDiagnostics _accountsClientDiagnostics; + private readonly Accounts _accountsRestClient; private readonly ClientDiagnostics _backupsUnderAccountClientDiagnostics; - private readonly BackupsUnderAccountRestOperations _backupsUnderAccountRestClient; + private readonly BackupsUnderAccount _backupsUnderAccountRestClient; private readonly NetAppAccountData _data; - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts"; + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/volumeGroups"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of NetAppAccountResource for mocking. protected NetAppAccountResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal NetAppAccountResource(ArmClient client, NetAppAccountData data) : this(client, data.Id) @@ -63,423 +50,120 @@ internal NetAppAccountResource(ArmClient client, NetAppAccountData data) : this( _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal NetAppAccountResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _netAppAccountAccountsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string netAppAccountAccountsApiVersion); - _netAppAccountAccountsRestClient = new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppAccountAccountsApiVersion); - _netAppVolumeGroupVolumeGroupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppVolumeGroupResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppVolumeGroupResource.ResourceType, out string netAppVolumeGroupVolumeGroupsApiVersion); - _netAppVolumeGroupVolumeGroupsRestClient = new VolumeGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppVolumeGroupVolumeGroupsApiVersion); - _netAppResourceQuotaLimitsAccountClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _netAppResourceQuotaLimitsAccountRestClient = new NetAppResourceQuotaLimitsAccountRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _backupsUnderAccountClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _backupsUnderAccountRestClient = new BackupsUnderAccountRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string netAppAccountApiVersion); + _volumeGroupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _volumeGroupsRestClient = new VolumeGroups(_volumeGroupsClientDiagnostics, Pipeline, Endpoint, netAppAccountApiVersion ?? "2025-09-01-preview"); + _accountsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _accountsRestClient = new Accounts(_accountsClientDiagnostics, Pipeline, Endpoint, netAppAccountApiVersion ?? "2025-09-01-preview"); + _backupsUnderAccountClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _backupsUnderAccountRestClient = new BackupsUnderAccount(_backupsUnderAccountClientDiagnostics, Pipeline, Endpoint, netAppAccountApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); } /// Gets whether or not the current instance has data. public virtual bool HasData { get; } /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. public virtual NetAppAccountData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// Gets a collection of CapacityPoolResources in the NetAppAccount. - /// An object representing collection of CapacityPoolResources and their operations over a CapacityPoolResource. - public virtual CapacityPoolCollection GetCapacityPools() - { - return GetCachedClient(client => new CapacityPoolCollection(client, Id)); - } - - /// - /// Get details of the specified capacity pool - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the capacity pool. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetCapacityPoolAsync(string poolName, CancellationToken cancellationToken = default) - { - return await GetCapacityPools().GetAsync(poolName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get details of the specified capacity pool - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName} - /// - /// - /// Operation Id - /// Pools_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the capacity pool. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetCapacityPool(string poolName, CancellationToken cancellationToken = default) - { - return GetCapacityPools().Get(poolName, cancellationToken); - } - - /// Gets a collection of SnapshotPolicyResources in the NetAppAccount. - /// An object representing collection of SnapshotPolicyResources and their operations over a SnapshotPolicyResource. - public virtual SnapshotPolicyCollection GetSnapshotPolicies() - { - return GetCachedClient(client => new SnapshotPolicyCollection(client, Id)); - } - - /// - /// Get a snapshot Policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the snapshot policy. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetSnapshotPolicyAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) - { - return await GetSnapshotPolicies().GetAsync(snapshotPolicyName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get a snapshot Policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the snapshot policy. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetSnapshotPolicy(string snapshotPolicyName, CancellationToken cancellationToken = default) - { - return GetSnapshotPolicies().Get(snapshotPolicyName, cancellationToken); - } - - /// Gets a collection of NetAppBackupPolicyResources in the NetAppAccount. - /// An object representing collection of NetAppBackupPolicyResources and their operations over a NetAppBackupPolicyResource. - public virtual NetAppBackupPolicyCollection GetNetAppBackupPolicies() - { - return GetCachedClient(client => new NetAppBackupPolicyCollection(client, Id)); - } - - /// - /// Get a particular backup Policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetNetAppBackupPolicyAsync(string backupPolicyName, CancellationToken cancellationToken = default) - { - return await GetNetAppBackupPolicies().GetAsync(backupPolicyName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get a particular backup Policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetNetAppBackupPolicy(string backupPolicyName, CancellationToken cancellationToken = default) - { - return GetNetAppBackupPolicies().Get(backupPolicyName, cancellationToken); - } - - /// Gets a collection of NetAppVolumeGroupResources in the NetAppAccount. - /// An object representing collection of NetAppVolumeGroupResources and their operations over a NetAppVolumeGroupResource. - public virtual NetAppVolumeGroupCollection GetNetAppVolumeGroups() + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { - return GetCachedClient(client => new NetAppVolumeGroupCollection(client, Id)); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}"; + return new ResourceIdentifier(resourceId); } - /// - /// Get details of the specified volume group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volumeGroup. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetNetAppVolumeGroupAsync(string volumeGroupName, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return await GetNetAppVolumeGroups().GetAsync(volumeGroupName, cancellationToken).ConfigureAwait(false); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } - /// - /// Get details of the specified volume group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volumeGroup. + /// List all volume groups for given account. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetNetAppVolumeGroup(string volumeGroupName, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetByNetAppAccountAsync(CancellationToken cancellationToken = default) { - return GetNetAppVolumeGroups().Get(volumeGroupName, cancellationToken); - } - - /// Gets a collection of NetAppBackupVaultResources in the NetAppAccount. - /// An object representing collection of NetAppBackupVaultResources and their operations over a NetAppBackupVaultResource. - public virtual NetAppBackupVaultCollection GetNetAppBackupVaults() - { - return GetCachedClient(client => new NetAppBackupVaultCollection(client, Id)); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new VolumeGroupsGetByNetAppAccountAsyncCollectionResultOfT(_volumeGroupsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); } - /// - /// Get the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Backup Vault. + /// List all volume groups for given account. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetNetAppBackupVaultAsync(string backupVaultName, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetByNetAppAccount(CancellationToken cancellationToken = default) { - return await GetNetAppBackupVaults().GetAsync(backupVaultName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Backup Vault. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetNetAppBackupVault(string backupVaultName, CancellationToken cancellationToken = default) - { - return GetNetAppBackupVaults().Get(backupVaultName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new VolumeGroupsGetByNetAppAccountCollectionResultOfT(_volumeGroupsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); } /// /// Get the NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Operation Id - /// Accounts_Get + /// Operation Id. + /// NetAppAccounts_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.Get"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.Get"); scope.Start(); try { - var response = await _netAppAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetAppAccountData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -493,33 +177,41 @@ public virtual async Task> GetAsync(Cancellation /// Get the NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Operation Id - /// Accounts_Get + /// Operation Id. + /// NetAppAccounts_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.Get"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.Get"); scope.Start(); try { - var response = _netAppAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetAppAccountData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -529,108 +221,24 @@ public virtual Response Get(CancellationToken cancellatio } } - /// - /// Delete the specified NetApp account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.Delete"); - scope.Start(); - try - { - var response = await _netAppAccountAccountsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete the specified NetApp account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.Delete"); - scope.Start(); - try - { - var response = _netAppAccountAccountsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - /// /// Patch the specified NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Operation Id - /// Accounts_Update + /// Operation Id. + /// NetAppAccounts_Update. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -642,14 +250,27 @@ public virtual async Task> UpdateAsync(WaitU { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.Update"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.Update"); scope.Start(); try { - var response = await _netAppAccountAccountsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppAccountOperationSource(Client), _netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, NetAppAccountPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new NetAppAccountOperationSource(Client), + _accountsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -663,20 +284,20 @@ public virtual async Task> UpdateAsync(WaitU /// Patch the specified NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Operation Id - /// Accounts_Update + /// Operation Id. + /// NetAppAccounts_Update. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -688,14 +309,27 @@ public virtual ArmOperation Update(WaitUntil waitUntil, N { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.Update"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.Update"); scope.Start(); try { - var response = _netAppAccountAccountsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - var operation = new NetAppArmOperation(new NetAppAccountOperationSource(Client), _netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, NetAppAccountPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new NetAppAccountOperationSource(Client), + _accountsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -706,38 +340,45 @@ public virtual ArmOperation Update(WaitUntil waitUntil, N } /// - /// Renew identity credentials that are used to authenticate to key vault, for customer-managed key encryption. If encryption.identity.principalId does not match identity.principalId, running this operation will fix it. + /// Delete the specified NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Operation Id - /// Accounts_RenewCredentials + /// Operation Id. + /// NetAppAccounts_Delete. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual async Task RenewCredentialsAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.RenewCredentials"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.Delete"); scope.Start(); try { - var response = await _netAppAccountAccountsRestClient.RenewCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateRenewCredentialsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_accountsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -748,38 +389,45 @@ public virtual async Task RenewCredentialsAsync(WaitUntil waitUnti } /// - /// Renew identity credentials that are used to authenticate to key vault, for customer-managed key encryption. If encryption.identity.principalId does not match identity.principalId, running this operation will fix it. + /// Delete the specified NetApp account /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}. /// /// - /// Operation Id - /// Accounts_RenewCredentials + /// Operation Id. + /// NetAppAccounts_Delete. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual ArmOperation RenewCredentials(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.RenewCredentials"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.Delete"); scope.Start(); try { - var response = _netAppAccountAccountsRestClient.RenewCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateRenewCredentialsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_accountsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -790,39 +438,45 @@ public virtual ArmOperation RenewCredentials(WaitUntil waitUntil, CancellationTo } /// - /// Transitions all volumes in a VNet to a different encryption key source (Microsoft-managed key or Azure Key Vault). Operation fails if targeted volumes share encryption sibling set with volumes from another account. + /// Renew identity credentials that are used to authenticate to key vault, for customer-managed key encryption. If encryption.identity.principalId does not match identity.principalId, running this operation will fix it. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/transitiontocmk + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials. /// /// - /// Operation Id - /// Accounts_TransitionToCmk + /// Operation Id. + /// NetAppAccounts_RenewCredentials. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The required parameters to perform encryption transition. /// The cancellation token to use. - public virtual async Task TransitionToCmkAsync(WaitUntil waitUntil, NetAppEncryptionTransitionContent content = null, CancellationToken cancellationToken = default) + public virtual async Task RenewCredentialsAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.TransitionToCmk"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.RenewCredentials"); scope.Start(); try { - var response = await _netAppAccountAccountsRestClient.TransitionToCmkAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateTransitionToCmkRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateRenewCredentialsRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_accountsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -833,39 +487,45 @@ public virtual async Task TransitionToCmkAsync(WaitUntil waitUntil } /// - /// Transitions all volumes in a VNet to a different encryption key source (Microsoft-managed key or Azure Key Vault). Operation fails if targeted volumes share encryption sibling set with volumes from another account. + /// Renew identity credentials that are used to authenticate to key vault, for customer-managed key encryption. If encryption.identity.principalId does not match identity.principalId, running this operation will fix it. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/transitiontocmk + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/renewCredentials. /// /// - /// Operation Id - /// Accounts_TransitionToCmk + /// Operation Id. + /// NetAppAccounts_RenewCredentials. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The required parameters to perform encryption transition. /// The cancellation token to use. - public virtual ArmOperation TransitionToCmk(WaitUntil waitUntil, NetAppEncryptionTransitionContent content = null, CancellationToken cancellationToken = default) + public virtual ArmOperation RenewCredentials(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.TransitionToCmk"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.RenewCredentials"); scope.Start(); try { - var response = _netAppAccountAccountsRestClient.TransitionToCmk(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateTransitionToCmkRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateRenewCredentialsRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_accountsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -876,80 +536,46 @@ public virtual ArmOperation TransitionToCmk(WaitUntil waitUntil, NetAppEncryptio } /// - /// Contains data from encryption.keyVaultProperties as well as information about which private endpoint is used by each encryption sibling set. Response from this endpoint can be modified and used as request body for POST request. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/getKeyVaultStatus - /// - /// - /// Operation Id - /// Accounts_GetChangeKeyVaultInformation - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task> GetChangeKeyVaultInformationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.GetChangeKeyVaultInformation"); - scope.Start(); - try - { - var response = await _netAppAccountAccountsRestClient.GetChangeKeyVaultInformationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppKeyVaultStatusResultOperationSource(), _netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateGetChangeKeyVaultInformationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Contains data from encryption.keyVaultProperties as well as information about which private endpoint is used by each encryption sibling set. Response from this endpoint can be modified and used as request body for POST request. + /// Transitions all volumes in a VNet to a different encryption key source (Microsoft-managed key or Azure Key Vault). Operation fails if targeted volumes share encryption sibling set with volumes from another account. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/getKeyVaultStatus + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/transitiontocmk. /// /// - /// Operation Id - /// Accounts_GetChangeKeyVaultInformation + /// Operation Id. + /// NetAppAccounts_TransitionToCmk. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The required parameters to perform encryption transition. /// The cancellation token to use. - public virtual ArmOperation GetChangeKeyVaultInformation(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task TransitionToCmkAsync(WaitUntil waitUntil, EncryptionTransitionRequest body = default, CancellationToken cancellationToken = default) { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.GetChangeKeyVaultInformation"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.TransitionToCmk"); scope.Start(); try { - var response = _netAppAccountAccountsRestClient.GetChangeKeyVaultInformation(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(new NetAppKeyVaultStatusResultOperationSource(), _netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateGetChangeKeyVaultInformationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateTransitionToCmkRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, EncryptionTransitionRequest.ToRequestContent(body), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_accountsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -960,39 +586,46 @@ public virtual ArmOperation GetChangeKeyVaultInforma } /// - /// Affects existing volumes that are encrypted with Key Vault/Managed HSM, and new volumes. Supports HSM to Key Vault, Key Vault to HSM, HSM to HSM and Key Vault to Key Vault. + /// Transitions all volumes in a VNet to a different encryption key source (Microsoft-managed key or Azure Key Vault). Operation fails if targeted volumes share encryption sibling set with volumes from another account. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/changeKeyVault + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/transitiontocmk. /// /// - /// Operation Id - /// Accounts_ChangeKeyVault + /// Operation Id. + /// NetAppAccounts_TransitionToCmk. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The required parameters to perform encryption migration. + /// The required parameters to perform encryption transition. /// The cancellation token to use. - public virtual async Task ChangeKeyVaultAsync(WaitUntil waitUntil, NetAppChangeKeyVault body = null, CancellationToken cancellationToken = default) + public virtual ArmOperation TransitionToCmk(WaitUntil waitUntil, EncryptionTransitionRequest body = default, CancellationToken cancellationToken = default) { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.ChangeKeyVault"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.TransitionToCmk"); scope.Start(); try { - var response = await _netAppAccountAccountsRestClient.ChangeKeyVaultAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateChangeKeyVaultRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateTransitionToCmkRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, EncryptionTransitionRequest.ToRequestContent(body), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_accountsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + { + operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -1003,189 +636,157 @@ public virtual async Task ChangeKeyVaultAsync(WaitUntil waitUntil, } /// - /// Affects existing volumes that are encrypted with Key Vault/Managed HSM, and new volumes. Supports HSM to Key Vault, Key Vault to HSM, HSM to HSM and Key Vault to Key Vault. + /// Contains data from encryption.keyVaultProperties as well as information about which private endpoint is used by each encryption sibling set. Response from this endpoint can be modified and used as request body for POST request. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/changeKeyVault + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/getKeyVaultStatus. /// /// - /// Operation Id - /// Accounts_ChangeKeyVault + /// Operation Id. + /// NetAppAccounts_GetChangeKeyVaultInformation. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The required parameters to perform encryption migration. /// The cancellation token to use. - public virtual ArmOperation ChangeKeyVault(WaitUntil waitUntil, NetAppChangeKeyVault body = null, CancellationToken cancellationToken = default) + public virtual async Task> GetChangeKeyVaultInformationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.ChangeKeyVault"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.GetChangeKeyVaultInformation"); scope.Start(); try { - var response = _netAppAccountAccountsRestClient.ChangeKeyVault(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body, cancellationToken); - var operation = new NetAppArmOperation(_netAppAccountAccountsClientDiagnostics, Pipeline, _netAppAccountAccountsRestClient.CreateChangeKeyVaultRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, body).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetChangeKeyVaultInformationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new GetKeyVaultStatusResponseOperationSource(), + _accountsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all volume groups for given account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups - /// - /// - /// Operation Id - /// VolumeGroups_ListByNetAppAccount - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVolumeGroupsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppVolumeGroupVolumeGroupsRestClient.CreateListByNetAppAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => NetAppVolumeGroupResult.DeserializeNetAppVolumeGroupResult(e), _netAppVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, "NetAppAccountResource.GetVolumeGroups", "value", null, cancellationToken); - } - - /// - /// List all volume groups for given account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups - /// - /// - /// Operation Id - /// VolumeGroups_ListByNetAppAccount - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVolumeGroups(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppVolumeGroupVolumeGroupsRestClient.CreateListByNetAppAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => NetAppVolumeGroupResult.DeserializeNetAppVolumeGroupResult(e), _netAppVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, "NetAppAccountResource.GetVolumeGroups", "value", null, cancellationToken); - } - - /// - /// Gets a list of quota limits for all quotas that are under account. Currently PoolsPerAccount is the only one. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/quotaLimits - /// - /// - /// Operation Id - /// NetAppResourceQuotaLimitsAccount_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetNetAppResourceQuotaLimitsAccountsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppResourceQuotaLimitsAccountRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppResourceQuotaLimitsAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem(e), _netAppResourceQuotaLimitsAccountClientDiagnostics, Pipeline, "NetAppAccountResource.GetNetAppResourceQuotaLimitsAccounts", "value", "nextLink", cancellationToken); + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Gets a list of quota limits for all quotas that are under account. Currently PoolsPerAccount is the only one. + /// Contains data from encryption.keyVaultProperties as well as information about which private endpoint is used by each encryption sibling set. Response from this endpoint can be modified and used as request body for POST request. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/quotaLimits + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/getKeyVaultStatus. + /// + /// + /// Operation Id. + /// NetAppAccounts_GetChangeKeyVaultInformation. /// /// - /// Operation Id - /// NetAppResourceQuotaLimitsAccount_List + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Resource. + /// . /// /// /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetNetAppResourceQuotaLimitsAccounts(CancellationToken cancellationToken = default) + public virtual ArmOperation GetChangeKeyVaultInformation(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppResourceQuotaLimitsAccountRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppResourceQuotaLimitsAccountRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem(e), _netAppResourceQuotaLimitsAccountClientDiagnostics, Pipeline, "NetAppAccountResource.GetNetAppResourceQuotaLimitsAccounts", "value", "nextLink", cancellationToken); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.GetChangeKeyVaultInformation"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetChangeKeyVaultInformationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new GetKeyVaultStatusResponseOperationSource(), + _accountsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get the default, current and usages account quota limit + /// Affects existing volumes that are encrypted with Key Vault/Managed HSM, and new volumes. Supports HSM to Key Vault, Key Vault to HSM, HSM to HSM and Key Vault to Key Vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/quotaLimits/{quotaLimitName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/changeKeyVault. /// /// - /// Operation Id - /// NetAppResourceQuotaLimitsAccount_Get + /// Operation Id. + /// NetAppAccounts_ChangeKeyVault. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . /// /// /// - /// The name of the Quota Limit. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The required parameters to perform encryption migration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetNetAppResourceQuotaLimitsAccountAsync(string quotaLimitName, CancellationToken cancellationToken = default) + public virtual async Task ChangeKeyVaultAsync(WaitUntil waitUntil, ChangeKeyVault body = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); - - using var scope = _netAppResourceQuotaLimitsAccountClientDiagnostics.CreateScope("NetAppAccountResource.GetNetAppResourceQuotaLimitsAccount"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.ChangeKeyVault"); scope.Start(); try { - var response = await _netAppResourceQuotaLimitsAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, quotaLimitName, cancellationToken).ConfigureAwait(false); - return response; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateChangeKeyVaultRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, Models.ChangeKeyVault.ToRequestContent(body), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_accountsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -1195,36 +796,47 @@ public virtual async Task> GetNetAppResour } /// - /// Get the default, current and usages account quota limit + /// Affects existing volumes that are encrypted with Key Vault/Managed HSM, and new volumes. Supports HSM to Key Vault, Key Vault to HSM, HSM to HSM and Key Vault to Key Vault. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/quotaLimits/{quotaLimitName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/changeKeyVault. /// /// - /// Operation Id - /// NetAppResourceQuotaLimitsAccount_Get + /// Operation Id. + /// NetAppAccounts_ChangeKeyVault. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . /// /// /// - /// The name of the Quota Limit. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The required parameters to perform encryption migration. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response GetNetAppResourceQuotaLimitsAccount(string quotaLimitName, CancellationToken cancellationToken = default) + public virtual ArmOperation ChangeKeyVault(WaitUntil waitUntil, ChangeKeyVault body = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); - - using var scope = _netAppResourceQuotaLimitsAccountClientDiagnostics.CreateScope("NetAppAccountResource.GetNetAppResourceQuotaLimitsAccount"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.ChangeKeyVault"); scope.Start(); try { - var response = _netAppResourceQuotaLimitsAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, quotaLimitName, cancellationToken); - return response; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateChangeKeyVaultRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, Models.ChangeKeyVault.ToRequestContent(body), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_accountsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -1237,16 +849,20 @@ public virtual Response GetNetAppResourceQuotaLimit /// Migrate the backups under a NetApp account to backup vault /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/migrateBackups + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/migrateBackups. + /// + /// + /// Operation Id. + /// NetAppAccounts_MigrateBackups. /// /// - /// Operation Id - /// BackupsUnderAccount_MigrateBackups + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Resource. + /// . /// /// /// @@ -1254,18 +870,25 @@ public virtual Response GetNetAppResourceQuotaLimit /// Migrate backups under an account payload supplied in the body of the operation. /// The cancellation token to use. /// is null. - public virtual async Task MigrateBackupsBackupsUnderAccountAsync(WaitUntil waitUntil, BackupsMigrationContent content, CancellationToken cancellationToken = default) + public virtual async Task MigrateBackupsAsync(WaitUntil waitUntil, BackupsMigrationRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _backupsUnderAccountClientDiagnostics.CreateScope("NetAppAccountResource.MigrateBackupsBackupsUnderAccount"); + using DiagnosticScope scope = _backupsUnderAccountClientDiagnostics.CreateScope("NetAppAccountResource.MigrateBackups"); scope.Start(); try { - var response = await _backupsUnderAccountRestClient.MigrateBackupsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_backupsUnderAccountClientDiagnostics, Pipeline, _backupsUnderAccountRestClient.CreateMigrateBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsUnderAccountRestClient.CreateMigrateBackupsRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, BackupsMigrationRequest.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_backupsUnderAccountClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -1279,16 +902,20 @@ public virtual async Task MigrateBackupsBackupsUnderAccountAsync(W /// Migrate the backups under a NetApp account to backup vault /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/migrateBackups + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/migrateBackups. /// /// - /// Operation Id - /// BackupsUnderAccount_MigrateBackups + /// Operation Id. + /// NetAppAccounts_MigrateBackups. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . /// /// /// @@ -1296,18 +923,25 @@ public virtual async Task MigrateBackupsBackupsUnderAccountAsync(W /// Migrate backups under an account payload supplied in the body of the operation. /// The cancellation token to use. /// is null. - public virtual ArmOperation MigrateBackupsBackupsUnderAccount(WaitUntil waitUntil, BackupsMigrationContent content, CancellationToken cancellationToken = default) + public virtual ArmOperation MigrateBackups(WaitUntil waitUntil, BackupsMigrationRequest content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _backupsUnderAccountClientDiagnostics.CreateScope("NetAppAccountResource.MigrateBackupsBackupsUnderAccount"); + using DiagnosticScope scope = _backupsUnderAccountClientDiagnostics.CreateScope("NetAppAccountResource.MigrateBackups"); scope.Start(); try { - var response = _backupsUnderAccountRestClient.MigrateBackups(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_backupsUnderAccountClientDiagnostics, Pipeline, _backupsUnderAccountRestClient.CreateMigrateBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsUnderAccountRestClient.CreateMigrateBackupsRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, BackupsMigrationRequest.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_backupsUnderAccountClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -1317,27 +951,7 @@ public virtual ArmOperation MigrateBackupsBackupsUnderAccount(WaitUntil waitUnti } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -1347,28 +961,34 @@ public virtual async Task> AddTagAsync(string ke Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.AddTag"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.AddTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetAppAccountData.FromResponse(result), result); + return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppAccountPatch(current.Location); - foreach (var tag in current.Tags) + NetAppAccountData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + NetAppAccountPatch patch = new NetAppAccountPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -1379,27 +999,7 @@ public virtual async Task> AddTagAsync(string ke } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -1409,28 +1009,34 @@ public virtual Response AddTag(string key, string value, Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.AddTag"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.AddTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new NetAppAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetAppAccountData.FromResponse(result), result); + return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppAccountPatch(current.Location); - foreach (var tag in current.Tags) + NetAppAccountData current = Get(cancellationToken: cancellationToken).Value.Data; + NetAppAccountPatch patch = new NetAppAccountPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -1441,53 +1047,39 @@ public virtual Response AddTag(string key, string value, } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.SetTags"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.SetTags"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetAppAccountData.FromResponse(result), result); + return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppAccountPatch(current.Location); + NetAppAccountData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + NetAppAccountPatch patch = new NetAppAccountPatch(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -1498,53 +1090,39 @@ public virtual async Task> SetTagsAsync(IDiction } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.SetTags"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.SetTags"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new NetAppAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetAppAccountData.FromResponse(result), result); + return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppAccountPatch(current.Location); + NetAppAccountData current = Get(cancellationToken: cancellationToken).Value.Data; + NetAppAccountPatch patch = new NetAppAccountPatch(); patch.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -1555,27 +1133,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -1583,28 +1141,34 @@ public virtual async Task> RemoveTagAsync(string { Argument.AssertNotNull(key, nameof(key)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.RemoveTag"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.RemoveTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetAppAccountData.FromResponse(result), result); + return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppAccountPatch(current.Location); - foreach (var tag in current.Tags) + NetAppAccountData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + NetAppAccountPatch patch = new NetAppAccountPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -1615,27 +1179,7 @@ public virtual async Task> RemoveTagAsync(string } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName} - /// - /// - /// Operation Id - /// Accounts_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -1643,28 +1187,34 @@ public virtual Response RemoveTag(string key, Cancellatio { Argument.AssertNotNull(key, nameof(key)); - using var scope = _netAppAccountAccountsClientDiagnostics.CreateScope("NetAppAccountResource.RemoveTag"); + using DiagnosticScope scope = _accountsClientDiagnostics.CreateScope("NetAppAccountResource.RemoveTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new NetAppAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _accountsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetAppAccountData.FromResponse(result), result); + return Response.FromValue(new NetAppAccountResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppAccountPatch(current.Location); - foreach (var tag in current.Tags) + NetAppAccountData current = Get(cancellationToken: cancellationToken).Value.Data; + NetAppAccountPatch patch = new NetAppAccountPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -1674,5 +1224,170 @@ public virtual Response RemoveTag(string key, Cancellatio throw; } } + + /// Gets a collection of VolumeGroupDetails in the . + /// An object representing collection of VolumeGroupDetails and their operations over a VolumeGroupDetailsResource. + public virtual VolumeGroupDetailsCollection GetVolumeGroupDetails() + { + return GetCachedClient(client => new VolumeGroupDetailsCollection(client, Id)); + } + + /// Get details of the specified volume group. + /// The name of the volumeGroup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVolumeGroupDetailsAsync(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + return await GetVolumeGroupDetails().GetAsync(volumeGroupName, cancellationToken).ConfigureAwait(false); + } + + /// Get details of the specified volume group. + /// The name of the volumeGroup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVolumeGroupDetails(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + return GetVolumeGroupDetails().Get(volumeGroupName, cancellationToken); + } + + /// Gets a collection of SnapshotPolicies in the . + /// An object representing collection of SnapshotPolicies and their operations over a SnapshotPolicyResource. + public virtual SnapshotPolicyCollection GetSnapshotPolicies() + { + return GetCachedClient(client => new SnapshotPolicyCollection(client, Id)); + } + + /// Get a snapshot Policy. + /// The name of the snapshot policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSnapshotPolicyAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + return await GetSnapshotPolicies().GetAsync(snapshotPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// Get a snapshot Policy. + /// The name of the snapshot policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSnapshotPolicy(string snapshotPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); + + return GetSnapshotPolicies().Get(snapshotPolicyName, cancellationToken); + } + + /// Gets a collection of BackupPolicies in the . + /// An object representing collection of BackupPolicies and their operations over a BackupPolicyResource. + public virtual BackupPolicyCollection GetBackupPolicies() + { + return GetCachedClient(client => new BackupPolicyCollection(client, Id)); + } + + /// Get a particular backup Policy. + /// Backup policy Name which uniquely identify backup policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupPolicyAsync(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + return await GetBackupPolicies().GetAsync(backupPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// Get a particular backup Policy. + /// Backup policy Name which uniquely identify backup policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupPolicy(string backupPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); + + return GetBackupPolicies().Get(backupPolicyName, cancellationToken); + } + + /// Gets a collection of BackupVaults in the . + /// An object representing collection of BackupVaults and their operations over a BackupVaultResource. + public virtual BackupVaultCollection GetBackupVaults() + { + return GetCachedClient(client => new BackupVaultCollection(client, Id)); + } + + /// Get the Backup Vault. + /// The name of the Backup Vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBackupVaultAsync(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + return await GetBackupVaults().GetAsync(backupVaultName, cancellationToken).ConfigureAwait(false); + } + + /// Get the Backup Vault. + /// The name of the Backup Vault. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBackupVault(string backupVaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + + return GetBackupVaults().Get(backupVaultName, cancellationToken); + } + + /// Gets a collection of CapacityPools in the . + /// An object representing collection of CapacityPools and their operations over a CapacityPoolResource. + public virtual CapacityPoolCollection GetCapacityPools() + { + return GetCachedClient(client => new CapacityPoolCollection(client, Id)); + } + + /// Get details of the specified capacity pool. + /// The name of the capacity pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetCapacityPoolAsync(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + return await GetCapacityPools().GetAsync(poolName, cancellationToken).ConfigureAwait(false); + } + + /// Get details of the specified capacity pool. + /// The name of the capacity pool. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetCapacityPool(string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + return GetCapacityPools().Get(poolName, cancellationToken); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupData.Serialization.cs deleted file mode 100644 index ec83c67f5c92..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupData.Serialization.cs +++ /dev/null @@ -1,368 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppBackupData : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(BackupId)) - { - writer.WritePropertyName("backupId"u8); - writer.WriteStringValue(BackupId); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("creationDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(SnapshotCreationOn)) - { - if (SnapshotCreationOn != null) - { - writer.WritePropertyName("snapshotCreationDate"u8); - writer.WriteStringValue(SnapshotCreationOn.Value, "O"); - } - else - { - writer.WriteNull("snapshotCreationDate"); - } - } - if (options.Format != "W" && Optional.IsDefined(CompletionOn)) - { - if (CompletionOn != null) - { - writer.WritePropertyName("completionDate"u8); - writer.WriteStringValue(CompletionOn.Value, "O"); - } - else - { - writer.WriteNull("completionDate"); - } - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(Size)) - { - writer.WritePropertyName("size"u8); - writer.WriteNumberValue(Size.Value); - } - if (Optional.IsDefined(Label)) - { - writer.WritePropertyName("label"u8); - writer.WriteStringValue(Label); - } - if (options.Format != "W" && Optional.IsDefined(BackupType)) - { - writer.WritePropertyName("backupType"u8); - writer.WriteStringValue(BackupType.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(FailureReason)) - { - writer.WritePropertyName("failureReason"u8); - writer.WriteStringValue(FailureReason); - } - writer.WritePropertyName("volumeResourceId"u8); - writer.WriteStringValue(VolumeResourceId); - if (Optional.IsDefined(UseExistingSnapshot)) - { - writer.WritePropertyName("useExistingSnapshot"u8); - writer.WriteBooleanValue(UseExistingSnapshot.Value); - } - if (Optional.IsDefined(SnapshotName)) - { - writer.WritePropertyName("snapshotName"u8); - writer.WriteStringValue(SnapshotName); - } - if (options.Format != "W" && Optional.IsDefined(BackupPolicyArmResourceId)) - { - writer.WritePropertyName("backupPolicyResourceId"u8); - writer.WriteStringValue(BackupPolicyArmResourceId); - } - if (options.Format != "W" && Optional.IsDefined(IsLargeVolume)) - { - writer.WritePropertyName("isLargeVolume"u8); - writer.WriteBooleanValue(IsLargeVolume.Value); - } - writer.WriteEndObject(); - } - - NetAppBackupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBackupData(document.RootElement, options); - } - - internal static NetAppBackupData DeserializeNetAppBackupData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string backupId = default; - DateTimeOffset? creationDate = default; - DateTimeOffset? snapshotCreationDate = default; - DateTimeOffset? completionDate = default; - string provisioningState = default; - long? size = default; - string label = default; - NetAppBackupType? backupType = default; - string failureReason = default; - ResourceIdentifier volumeResourceId = default; - bool? useExistingSnapshot = default; - string snapshotName = default; - ResourceIdentifier backupPolicyResourceId = default; - bool? isLargeVolume = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("backupId"u8)) - { - backupId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("creationDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - creationDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("snapshotCreationDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - snapshotCreationDate = null; - continue; - } - snapshotCreationDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("completionDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - completionDate = null; - continue; - } - completionDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("size"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - size = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("label"u8)) - { - label = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("backupType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - backupType = new NetAppBackupType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("failureReason"u8)) - { - failureReason = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("volumeResourceId"u8)) - { - volumeResourceId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("useExistingSnapshot"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - useExistingSnapshot = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("snapshotName"u8)) - { - snapshotName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("backupPolicyResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - backupPolicyResourceId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("isLargeVolume"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isLargeVolume = property0.Value.GetBoolean(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBackupData( - id, - name, - type, - systemData, - backupId, - creationDate, - snapshotCreationDate, - completionDate, - provisioningState, - size, - label, - backupType, - failureReason, - volumeResourceId, - useExistingSnapshot, - snapshotName, - backupPolicyResourceId, - isLargeVolume, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBackupData)} does not support writing '{options.Format}' format."); - } - } - - NetAppBackupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBackupData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBackupData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyCollection.cs deleted file mode 100644 index 89f7b7e7e745..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyCollection.cs +++ /dev/null @@ -1,491 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNetAppBackupPolicies method from an instance of . - /// - public partial class NetAppBackupPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _netAppBackupPolicyBackupPoliciesClientDiagnostics; - private readonly BackupPoliciesRestOperations _netAppBackupPolicyBackupPoliciesRestClient; - - /// Initializes a new instance of the class for mocking. - protected NetAppBackupPolicyCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal NetAppBackupPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppBackupPolicyBackupPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppBackupPolicyResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppBackupPolicyResource.ResourceType, out string netAppBackupPolicyBackupPoliciesApiVersion); - _netAppBackupPolicyBackupPoliciesRestClient = new BackupPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppBackupPolicyBackupPoliciesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != NetAppAccountResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetAppAccountResource.ResourceType), nameof(id)); - } - - /// - /// Create a backup policy for Netapp Account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Backup policy Name which uniquely identify backup policy. - /// Backup policy object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string backupPolicyName, NetAppBackupPolicyData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _netAppBackupPolicyBackupPoliciesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppBackupPolicyOperationSource(Client), _netAppBackupPolicyBackupPoliciesClientDiagnostics, Pipeline, _netAppBackupPolicyBackupPoliciesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a backup policy for Netapp Account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Backup policy Name which uniquely identify backup policy. - /// Backup policy object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string backupPolicyName, NetAppBackupPolicyData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _netAppBackupPolicyBackupPoliciesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppBackupPolicyOperationSource(Client), _netAppBackupPolicyBackupPoliciesClientDiagnostics, Pipeline, _netAppBackupPolicyBackupPoliciesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a particular backup Policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string backupPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyCollection.Get"); - scope.Start(); - try - { - var response = await _netAppBackupPolicyBackupPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupPolicyResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a particular backup Policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string backupPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyCollection.Get"); - scope.Start(); - try - { - var response = _netAppBackupPolicyBackupPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupPolicyResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List backup policies for Netapp Account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies - /// - /// - /// Operation Id - /// BackupPolicies_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppBackupPolicyBackupPoliciesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new NetAppBackupPolicyResource(Client, NetAppBackupPolicyData.DeserializeNetAppBackupPolicyData(e)), _netAppBackupPolicyBackupPoliciesClientDiagnostics, Pipeline, "NetAppBackupPolicyCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// List backup policies for Netapp Account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies - /// - /// - /// Operation Id - /// BackupPolicies_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppBackupPolicyBackupPoliciesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new NetAppBackupPolicyResource(Client, NetAppBackupPolicyData.DeserializeNetAppBackupPolicyData(e)), _netAppBackupPolicyBackupPoliciesClientDiagnostics, Pipeline, "NetAppBackupPolicyCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string backupPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyCollection.Exists"); - scope.Start(); - try - { - var response = await _netAppBackupPolicyBackupPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string backupPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyCollection.Exists"); - scope.Start(); - try - { - var response = _netAppBackupPolicyBackupPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string backupPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _netAppBackupPolicyBackupPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupPolicyResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string backupPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyCollection.GetIfExists"); - scope.Start(); - try - { - var response = _netAppBackupPolicyBackupPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupPolicyName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupPolicyResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyData.Serialization.cs deleted file mode 100644 index 8feb4983ee70..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyData.Serialization.cs +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppBackupPolicyData : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupPolicyData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (options.Format != "W" && Optional.IsDefined(ETag)) - { - writer.WritePropertyName("etag"u8); - writer.WriteStringValue(ETag.Value.ToString()); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(BackupPolicyId)) - { - writer.WritePropertyName("backupPolicyId"u8); - writer.WriteStringValue(BackupPolicyId); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsDefined(DailyBackupsToKeep)) - { - writer.WritePropertyName("dailyBackupsToKeep"u8); - writer.WriteNumberValue(DailyBackupsToKeep.Value); - } - if (Optional.IsDefined(WeeklyBackupsToKeep)) - { - writer.WritePropertyName("weeklyBackupsToKeep"u8); - writer.WriteNumberValue(WeeklyBackupsToKeep.Value); - } - if (Optional.IsDefined(MonthlyBackupsToKeep)) - { - writer.WritePropertyName("monthlyBackupsToKeep"u8); - writer.WriteNumberValue(MonthlyBackupsToKeep.Value); - } - if (options.Format != "W" && Optional.IsDefined(VolumesAssigned)) - { - writer.WritePropertyName("volumesAssigned"u8); - writer.WriteNumberValue(VolumesAssigned.Value); - } - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); - } - if (options.Format != "W" && Optional.IsCollectionDefined(VolumeBackups)) - { - writer.WritePropertyName("volumeBackups"u8); - writer.WriteStartArray(); - foreach (var item in VolumeBackups) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - - NetAppBackupPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupPolicyData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBackupPolicyData(document.RootElement, options); - } - - internal static NetAppBackupPolicyData DeserializeNetAppBackupPolicyData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ETag? etag = default; - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - ResourceIdentifier backupPolicyId = default; - string provisioningState = default; - int? dailyBackupsToKeep = default; - int? weeklyBackupsToKeep = default; - int? monthlyBackupsToKeep = default; - int? volumesAssigned = default; - bool? enabled = default; - IReadOnlyList volumeBackups = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("etag"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - etag = new ETag(property.Value.GetString()); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("backupPolicyId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - backupPolicyId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("dailyBackupsToKeep"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dailyBackupsToKeep = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("weeklyBackupsToKeep"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - weeklyBackupsToKeep = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("monthlyBackupsToKeep"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - monthlyBackupsToKeep = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("volumesAssigned"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - volumesAssigned = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("enabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("volumeBackups"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(NetAppVolumeBackupDetail.DeserializeNetAppVolumeBackupDetail(item, options)); - } - volumeBackups = array; - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBackupPolicyData( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - etag, - backupPolicyId, - provisioningState, - dailyBackupsToKeep, - weeklyBackupsToKeep, - monthlyBackupsToKeep, - volumesAssigned, - enabled, - volumeBackups ?? new ChangeTrackingList(), - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBackupPolicyData)} does not support writing '{options.Format}' format."); - } - } - - NetAppBackupPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBackupPolicyData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBackupPolicyData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyData.cs deleted file mode 100644 index 07e3ede74a9e..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyData.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing the NetAppBackupPolicy data model. - /// Backup policy information - /// - public partial class NetAppBackupPolicyData : TrackedResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The location. - public NetAppBackupPolicyData(AzureLocation location) : base(location) - { - VolumeBackups = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// Backup Policy GUID ID. - /// Azure lifecycle management. - /// Daily backups count to keep. - /// Weekly backups count to keep. - /// Monthly backups count to keep. - /// Volumes using current backup policy. - /// The property to decide policy is enabled or not. - /// A list of volumes assigned to this policy. - /// Keeps track of any properties unknown to the library. - internal NetAppBackupPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ResourceIdentifier backupPolicyId, string provisioningState, int? dailyBackupsToKeep, int? weeklyBackupsToKeep, int? monthlyBackupsToKeep, int? volumesAssigned, bool? isEnabled, IReadOnlyList volumeBackups, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) - { - ETag = etag; - BackupPolicyId = backupPolicyId; - ProvisioningState = provisioningState; - DailyBackupsToKeep = dailyBackupsToKeep; - WeeklyBackupsToKeep = weeklyBackupsToKeep; - MonthlyBackupsToKeep = monthlyBackupsToKeep; - VolumesAssigned = volumesAssigned; - IsEnabled = isEnabled; - VolumeBackups = volumeBackups; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppBackupPolicyData() - { - } - - /// A unique read-only string that changes whenever the resource is updated. - public ETag? ETag { get; } - /// Backup Policy GUID ID. - public ResourceIdentifier BackupPolicyId { get; } - /// Azure lifecycle management. - public string ProvisioningState { get; } - /// Daily backups count to keep. - public int? DailyBackupsToKeep { get; set; } - /// Weekly backups count to keep. - public int? WeeklyBackupsToKeep { get; set; } - /// Monthly backups count to keep. - public int? MonthlyBackupsToKeep { get; set; } - /// Volumes using current backup policy. - public int? VolumesAssigned { get; } - /// The property to decide policy is enabled or not. - public bool? IsEnabled { get; set; } - /// A list of volumes assigned to this policy. - public IReadOnlyList VolumeBackups { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.Serialization.cs deleted file mode 100644 index 821ee05367af..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppBackupPolicyResource : IJsonModel - { - private static NetAppBackupPolicyData s_dataDeserializationInstance; - private static NetAppBackupPolicyData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - NetAppBackupPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); - - NetAppBackupPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.cs deleted file mode 100644 index 7cf27e24041e..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupPolicyResource.cs +++ /dev/null @@ -1,707 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A Class representing a NetAppBackupPolicy along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNetAppBackupPolicyResource method. - /// Otherwise you can get one from its parent resource using the GetNetAppBackupPolicy method. - /// - public partial class NetAppBackupPolicyResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The backupPolicyName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _netAppBackupPolicyBackupPoliciesClientDiagnostics; - private readonly BackupPoliciesRestOperations _netAppBackupPolicyBackupPoliciesRestClient; - private readonly NetAppBackupPolicyData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/backupPolicies"; - - /// Initializes a new instance of the class for mocking. - protected NetAppBackupPolicyResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NetAppBackupPolicyResource(ArmClient client, NetAppBackupPolicyData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NetAppBackupPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppBackupPolicyBackupPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string netAppBackupPolicyBackupPoliciesApiVersion); - _netAppBackupPolicyBackupPoliciesRestClient = new BackupPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppBackupPolicyBackupPoliciesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NetAppBackupPolicyData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get a particular backup Policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.Get"); - scope.Start(); - try - { - var response = await _netAppBackupPolicyBackupPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupPolicyResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a particular backup Policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.Get"); - scope.Start(); - try - { - var response = _netAppBackupPolicyBackupPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupPolicyResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete backup policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.Delete"); - scope.Start(); - try - { - var response = await _netAppBackupPolicyBackupPoliciesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppBackupPolicyBackupPoliciesClientDiagnostics, Pipeline, _netAppBackupPolicyBackupPoliciesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete backup policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.Delete"); - scope.Start(); - try - { - var response = _netAppBackupPolicyBackupPoliciesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppBackupPolicyBackupPoliciesClientDiagnostics, Pipeline, _netAppBackupPolicyBackupPoliciesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch a backup policy for Netapp Account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Backup policy object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, NetAppBackupPolicyPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.Update"); - scope.Start(); - try - { - var response = await _netAppBackupPolicyBackupPoliciesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppBackupPolicyOperationSource(Client), _netAppBackupPolicyBackupPoliciesClientDiagnostics, Pipeline, _netAppBackupPolicyBackupPoliciesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch a backup policy for Netapp Account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Backup policy object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, NetAppBackupPolicyPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.Update"); - scope.Start(); - try - { - var response = _netAppBackupPolicyBackupPoliciesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new NetAppArmOperation(new NetAppBackupPolicyOperationSource(Client), _netAppBackupPolicyBackupPoliciesClientDiagnostics, Pipeline, _netAppBackupPolicyBackupPoliciesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. - /// The cancellation token to use. - /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.AddTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues[key] = value; - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppBackupPolicyBackupPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppBackupPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppBackupPolicyPatch(current.Location); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. - /// The cancellation token to use. - /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.AddTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppBackupPolicyBackupPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppBackupPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppBackupPolicyPatch(current.Location); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. - /// The cancellation token to use. - /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tags, nameof(tags)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.SetTags"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppBackupPolicyBackupPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppBackupPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppBackupPolicyPatch(current.Location); - patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. - /// The cancellation token to use. - /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tags, nameof(tags)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.SetTags"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppBackupPolicyBackupPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppBackupPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppBackupPolicyPatch(current.Location); - patch.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The cancellation token to use. - /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.RemoveTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.Remove(key); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppBackupPolicyBackupPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppBackupPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppBackupPolicyPatch(current.Location); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName} - /// - /// - /// Operation Id - /// BackupPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The cancellation token to use. - /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - - using var scope = _netAppBackupPolicyBackupPoliciesClientDiagnostics.CreateScope("NetAppBackupPolicyResource.RemoveTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppBackupPolicyBackupPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppBackupPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppBackupPolicyPatch(current.Location); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupCollection.cs deleted file mode 100644 index 4c083adab3fc..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupCollection.cs +++ /dev/null @@ -1,495 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNetAppBackupVaultBackups method from an instance of . - /// - public partial class NetAppBackupVaultBackupCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _netAppBackupVaultBackupBackupsClientDiagnostics; - private readonly BackupsRestOperations _netAppBackupVaultBackupBackupsRestClient; - - /// Initializes a new instance of the class for mocking. - protected NetAppBackupVaultBackupCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal NetAppBackupVaultBackupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppBackupVaultBackupBackupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppBackupVaultBackupResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppBackupVaultBackupResource.ResourceType, out string netAppBackupVaultBackupBackupsApiVersion); - _netAppBackupVaultBackupBackupsRestClient = new BackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppBackupVaultBackupBackupsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != NetAppBackupVaultResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetAppBackupVaultResource.ResourceType), nameof(id)); - } - - /// - /// Create a backup under the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the backup. - /// Backup object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string backupName, NetAppBackupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupBackupsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppBackupVaultBackupOperationSource(Client), _netAppBackupVaultBackupBackupsClientDiagnostics, Pipeline, _netAppBackupVaultBackupBackupsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a backup under the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the backup. - /// Backup object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string backupName, NetAppBackupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupBackupsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppBackupVaultBackupOperationSource(Client), _netAppBackupVaultBackupBackupsClientDiagnostics, Pipeline, _netAppBackupVaultBackupBackupsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the specified Backup under Backup Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the backup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupCollection.Get"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupBackupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the specified Backup under Backup Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the backup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupCollection.Get"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupBackupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all backups Under a Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups - /// - /// - /// Operation Id - /// Backups_ListByVault - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppBackupVaultBackupBackupsRestClient.CreateListByVaultRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppBackupVaultBackupBackupsRestClient.CreateListByVaultNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetAppBackupVaultBackupResource(Client, NetAppBackupData.DeserializeNetAppBackupData(e)), _netAppBackupVaultBackupBackupsClientDiagnostics, Pipeline, "NetAppBackupVaultBackupCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// List all backups Under a Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups - /// - /// - /// Operation Id - /// Backups_ListByVault - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppBackupVaultBackupBackupsRestClient.CreateListByVaultRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppBackupVaultBackupBackupsRestClient.CreateListByVaultNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetAppBackupVaultBackupResource(Client, NetAppBackupData.DeserializeNetAppBackupData(e)), _netAppBackupVaultBackupBackupsClientDiagnostics, Pipeline, "NetAppBackupVaultBackupCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the backup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupCollection.Exists"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupBackupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the backup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupCollection.Exists"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupBackupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the backup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupBackupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the backup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupCollection.GetIfExists"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupBackupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, backupName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupResource.Serialization.cs deleted file mode 100644 index 28bd705187ec..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupResource.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppBackupVaultBackupResource : IJsonModel - { - private static NetAppBackupData s_dataDeserializationInstance; - private static NetAppBackupData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - NetAppBackupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); - - NetAppBackupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupResource.cs deleted file mode 100644 index b891c962dc98..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultBackupResource.cs +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A Class representing a NetAppBackupVaultBackup along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNetAppBackupVaultBackupResource method. - /// Otherwise you can get one from its parent resource using the GetNetAppBackupVaultBackup method. - /// - public partial class NetAppBackupVaultBackupResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The backupVaultName. - /// The backupName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _netAppBackupVaultBackupBackupsClientDiagnostics; - private readonly BackupsRestOperations _netAppBackupVaultBackupBackupsRestClient; - private readonly ClientDiagnostics _backupsUnderBackupVaultClientDiagnostics; - private readonly BackupsUnderBackupVaultRestOperations _backupsUnderBackupVaultRestClient; - private readonly NetAppBackupData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/backupVaults/backups"; - - /// Initializes a new instance of the class for mocking. - protected NetAppBackupVaultBackupResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NetAppBackupVaultBackupResource(ArmClient client, NetAppBackupData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NetAppBackupVaultBackupResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppBackupVaultBackupBackupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string netAppBackupVaultBackupBackupsApiVersion); - _netAppBackupVaultBackupBackupsRestClient = new BackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppBackupVaultBackupBackupsApiVersion); - _backupsUnderBackupVaultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _backupsUnderBackupVaultRestClient = new BackupsUnderBackupVaultRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NetAppBackupData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get the specified Backup under Backup Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupResource.Get"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupBackupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the specified Backup under Backup Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupResource.Get"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupBackupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultBackupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a Backup under the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupResource.Delete"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupBackupsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppBackupVaultBackupBackupsClientDiagnostics, Pipeline, _netAppBackupVaultBackupBackupsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a Backup under the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupResource.Delete"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupBackupsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppBackupVaultBackupBackupsClientDiagnostics, Pipeline, _netAppBackupVaultBackupBackupsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch a Backup under the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Backup object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, NetAppBackupVaultBackupPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupResource.Update"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupBackupsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppBackupVaultBackupOperationSource(Client), _netAppBackupVaultBackupBackupsClientDiagnostics, Pipeline, _netAppBackupVaultBackupBackupsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch a Backup under the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Backup object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, NetAppBackupVaultBackupPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppBackupVaultBackupResource.Update"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupBackupsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new NetAppArmOperation(new NetAppBackupVaultBackupOperationSource(Client), _netAppBackupVaultBackupBackupsClientDiagnostics, Pipeline, _netAppBackupVaultBackupBackupsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Restore the specified files from the specified backup to the active filesystem - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}/restoreFiles - /// - /// - /// Operation Id - /// BackupsUnderBackupVault_RestoreFiles - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Restore payload supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task RestoreFilesBackupsUnderBackupVaultAsync(WaitUntil waitUntil, NetAppVolumeBackupBackupRestoreFilesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _backupsUnderBackupVaultClientDiagnostics.CreateScope("NetAppBackupVaultBackupResource.RestoreFilesBackupsUnderBackupVault"); - scope.Start(); - try - { - var response = await _backupsUnderBackupVaultRestClient.RestoreFilesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_backupsUnderBackupVaultClientDiagnostics, Pipeline, _backupsUnderBackupVaultRestClient.CreateRestoreFilesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Restore the specified files from the specified backup to the active filesystem - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}/restoreFiles - /// - /// - /// Operation Id - /// BackupsUnderBackupVault_RestoreFiles - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Restore payload supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation RestoreFilesBackupsUnderBackupVault(WaitUntil waitUntil, NetAppVolumeBackupBackupRestoreFilesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _backupsUnderBackupVaultClientDiagnostics.CreateScope("NetAppBackupVaultBackupResource.RestoreFilesBackupsUnderBackupVault"); - scope.Start(); - try - { - var response = _backupsUnderBackupVaultRestClient.RestoreFiles(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_backupsUnderBackupVaultClientDiagnostics, Pipeline, _backupsUnderBackupVaultRestClient.CreateRestoreFilesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultCollection.cs deleted file mode 100644 index bcc8fb5cb07b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNetAppBackupVaults method from an instance of . - /// - public partial class NetAppBackupVaultCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _netAppBackupVaultBackupVaultsClientDiagnostics; - private readonly BackupVaultsRestOperations _netAppBackupVaultBackupVaultsRestClient; - - /// Initializes a new instance of the class for mocking. - protected NetAppBackupVaultCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal NetAppBackupVaultCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppBackupVaultBackupVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppBackupVaultResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppBackupVaultResource.ResourceType, out string netAppBackupVaultBackupVaultsApiVersion); - _netAppBackupVaultBackupVaultsRestClient = new BackupVaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppBackupVaultBackupVaultsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != NetAppAccountResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetAppAccountResource.ResourceType), nameof(id)); - } - - /// - /// Create or update the specified Backup Vault in the NetApp account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the Backup Vault. - /// BackupVault object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string backupVaultName, NetAppBackupVaultData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupVaultsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupVaultName, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppBackupVaultOperationSource(Client), _netAppBackupVaultBackupVaultsClientDiagnostics, Pipeline, _netAppBackupVaultBackupVaultsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupVaultName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create or update the specified Backup Vault in the NetApp account - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the Backup Vault. - /// BackupVault object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string backupVaultName, NetAppBackupVaultData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupVaultsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupVaultName, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppBackupVaultOperationSource(Client), _netAppBackupVaultBackupVaultsClientDiagnostics, Pipeline, _netAppBackupVaultBackupVaultsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupVaultName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Backup Vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string backupVaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultCollection.Get"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupVaultName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Backup Vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string backupVaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultCollection.Get"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupVaultName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List and describe all Backup Vaults in the NetApp account. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults - /// - /// - /// Operation Id - /// BackupVaults_ListByNetAppAccount - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppBackupVaultBackupVaultsRestClient.CreateListByNetAppAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppBackupVaultBackupVaultsRestClient.CreateListByNetAppAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetAppBackupVaultResource(Client, NetAppBackupVaultData.DeserializeNetAppBackupVaultData(e)), _netAppBackupVaultBackupVaultsClientDiagnostics, Pipeline, "NetAppBackupVaultCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// List and describe all Backup Vaults in the NetApp account. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults - /// - /// - /// Operation Id - /// BackupVaults_ListByNetAppAccount - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppBackupVaultBackupVaultsRestClient.CreateListByNetAppAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppBackupVaultBackupVaultsRestClient.CreateListByNetAppAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetAppBackupVaultResource(Client, NetAppBackupVaultData.DeserializeNetAppBackupVaultData(e)), _netAppBackupVaultBackupVaultsClientDiagnostics, Pipeline, "NetAppBackupVaultCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Backup Vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string backupVaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultCollection.Exists"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupVaultName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Backup Vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string backupVaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultCollection.Exists"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupVaultName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Backup Vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string backupVaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupVaultName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Backup Vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string backupVaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultCollection.GetIfExists"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, backupVaultName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultData.Serialization.cs deleted file mode 100644 index 3ebd53f0ab4a..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultData.Serialization.cs +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppBackupVaultData : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupVaultData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - writer.WriteEndObject(); - } - - NetAppBackupVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBackupVaultData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBackupVaultData(document.RootElement, options); - } - - internal static NetAppBackupVaultData DeserializeNetAppBackupVaultData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBackupVaultData( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - provisioningState, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBackupVaultData)} does not support writing '{options.Format}' format."); - } - } - - NetAppBackupVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBackupVaultData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBackupVaultData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultData.cs deleted file mode 100644 index fd76bbbfcf60..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultData.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing the NetAppBackupVault data model. - /// Backup Vault information - /// - public partial class NetAppBackupVaultData : TrackedResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The location. - public NetAppBackupVaultData(AzureLocation location) : base(location) - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Azure lifecycle management. - /// Keeps track of any properties unknown to the library. - internal NetAppBackupVaultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) - { - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppBackupVaultData() - { - } - - /// Azure lifecycle management. - public string ProvisioningState { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultResource.Serialization.cs deleted file mode 100644 index b51f3687905e..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultResource.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppBackupVaultResource : IJsonModel - { - private static NetAppBackupVaultData s_dataDeserializationInstance; - private static NetAppBackupVaultData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - NetAppBackupVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); - - NetAppBackupVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultResource.cs deleted file mode 100644 index 65b9b79df24b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBackupVaultResource.cs +++ /dev/null @@ -1,776 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A Class representing a NetAppBackupVault along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNetAppBackupVaultResource method. - /// Otherwise you can get one from its parent resource using the GetNetAppBackupVault method. - /// - public partial class NetAppBackupVaultResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The backupVaultName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _netAppBackupVaultBackupVaultsClientDiagnostics; - private readonly BackupVaultsRestOperations _netAppBackupVaultBackupVaultsRestClient; - private readonly NetAppBackupVaultData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/backupVaults"; - - /// Initializes a new instance of the class for mocking. - protected NetAppBackupVaultResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NetAppBackupVaultResource(ArmClient client, NetAppBackupVaultData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NetAppBackupVaultResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppBackupVaultBackupVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string netAppBackupVaultBackupVaultsApiVersion); - _netAppBackupVaultBackupVaultsRestClient = new BackupVaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppBackupVaultBackupVaultsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NetAppBackupVaultData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// Gets a collection of NetAppBackupVaultBackupResources in the NetAppBackupVault. - /// An object representing collection of NetAppBackupVaultBackupResources and their operations over a NetAppBackupVaultBackupResource. - public virtual NetAppBackupVaultBackupCollection GetNetAppBackupVaultBackups() - { - return GetCachedClient(client => new NetAppBackupVaultBackupCollection(client, Id)); - } - - /// - /// Get the specified Backup under Backup Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the backup. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetNetAppBackupVaultBackupAsync(string backupName, CancellationToken cancellationToken = default) - { - return await GetNetAppBackupVaultBackups().GetAsync(backupName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the specified Backup under Backup Vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName} - /// - /// - /// Operation Id - /// Backups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the backup. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetNetAppBackupVaultBackup(string backupName, CancellationToken cancellationToken = default) - { - return GetNetAppBackupVaultBackups().Get(backupName, cancellationToken); - } - - /// - /// Get the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.Get"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.Get"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBackupVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete the specified Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.Delete"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupVaultsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppBackupVaultBackupVaultsClientDiagnostics, Pipeline, _netAppBackupVaultBackupVaultsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete the specified Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.Delete"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupVaultsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppBackupVaultBackupVaultsClientDiagnostics, Pipeline, _netAppBackupVaultBackupVaultsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch the specified NetApp Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Backup Vault object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, NetAppBackupVaultPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.Update"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupVaultsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppBackupVaultOperationSource(Client), _netAppBackupVaultBackupVaultsClientDiagnostics, Pipeline, _netAppBackupVaultBackupVaultsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch the specified NetApp Backup Vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Backup Vault object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, NetAppBackupVaultPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.Update"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupVaultsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new NetAppArmOperation(new NetAppBackupVaultOperationSource(Client), _netAppBackupVaultBackupVaultsClientDiagnostics, Pipeline, _netAppBackupVaultBackupVaultsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. - /// The cancellation token to use. - /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.AddTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues[key] = value; - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppBackupVaultBackupVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppBackupVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppBackupVaultPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. - /// The cancellation token to use. - /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.AddTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppBackupVaultBackupVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppBackupVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppBackupVaultPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. - /// The cancellation token to use. - /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tags, nameof(tags)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.SetTags"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppBackupVaultBackupVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppBackupVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppBackupVaultPatch(); - patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. - /// The cancellation token to use. - /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tags, nameof(tags)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.SetTags"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppBackupVaultBackupVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppBackupVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppBackupVaultPatch(); - patch.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The cancellation token to use. - /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.RemoveTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.Remove(key); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppBackupVaultBackupVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppBackupVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppBackupVaultPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName} - /// - /// - /// Operation Id - /// BackupVaults_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The cancellation token to use. - /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - - using var scope = _netAppBackupVaultBackupVaultsClientDiagnostics.CreateScope("NetAppBackupVaultResource.RemoveTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppBackupVaultBackupVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppBackupVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppBackupVaultPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketCollection.cs deleted file mode 100644 index 4286cf1d1359..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNetAppBuckets method from an instance of . - /// - public partial class NetAppBucketCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _netAppBucketBucketsClientDiagnostics; - private readonly BucketsRestOperations _netAppBucketBucketsRestClient; - - /// Initializes a new instance of the class for mocking. - protected NetAppBucketCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal NetAppBucketCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppBucketBucketsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppBucketResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppBucketResource.ResourceType, out string netAppBucketBucketsApiVersion); - _netAppBucketBucketsRestClient = new BucketsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppBucketBucketsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != NetAppVolumeResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetAppVolumeResource.ResourceType), nameof(id)); - } - - /// - /// Creates or updates a bucket for a volume. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the bucket. - /// The bucket details including user details, and the volume path that should be mounted inside the bucket. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string bucketName, NetAppBucketData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _netAppBucketBucketsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppBucketOperationSource(Client), _netAppBucketBucketsClientDiagnostics, Pipeline, _netAppBucketBucketsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates or updates a bucket for a volume. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the bucket. - /// The bucket details including user details, and the volume path that should be mounted inside the bucket. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string bucketName, NetAppBucketData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _netAppBucketBucketsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppBucketOperationSource(Client), _netAppBucketBucketsClientDiagnostics, Pipeline, _netAppBucketBucketsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the bucket. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string bucketName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketCollection.Get"); - scope.Start(); - try - { - var response = await _netAppBucketBucketsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBucketResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the bucket. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string bucketName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketCollection.Get"); - scope.Start(); - try - { - var response = _netAppBucketBucketsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBucketResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Describes all buckets belonging to a volume. Buckets allow additional services, such as AI services, connect to the volume data contained in those buckets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets - /// - /// - /// Operation Id - /// Buckets_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppBucketBucketsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppBucketBucketsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetAppBucketResource(Client, NetAppBucketData.DeserializeNetAppBucketData(e)), _netAppBucketBucketsClientDiagnostics, Pipeline, "NetAppBucketCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Describes all buckets belonging to a volume. Buckets allow additional services, such as AI services, connect to the volume data contained in those buckets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets - /// - /// - /// Operation Id - /// Buckets_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppBucketBucketsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppBucketBucketsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetAppBucketResource(Client, NetAppBucketData.DeserializeNetAppBucketData(e)), _netAppBucketBucketsClientDiagnostics, Pipeline, "NetAppBucketCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the bucket. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string bucketName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketCollection.Exists"); - scope.Start(); - try - { - var response = await _netAppBucketBucketsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the bucket. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string bucketName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketCollection.Exists"); - scope.Start(); - try - { - var response = _netAppBucketBucketsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the bucket. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string bucketName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _netAppBucketBucketsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppBucketResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the bucket. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string bucketName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketCollection.GetIfExists"); - scope.Start(); - try - { - var response = _netAppBucketBucketsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, bucketName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppBucketResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketData.Serialization.cs deleted file mode 100644 index 879242d47e86..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketData.Serialization.cs +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppBucketData : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Path)) - { - writer.WritePropertyName("path"u8); - writer.WriteStringValue(Path); - } - if (Optional.IsDefined(FileSystemUser)) - { - writer.WritePropertyName("fileSystemUser"u8); - writer.WriteObjectValue(FileSystemUser, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToSerialString()); - } - if (options.Format != "W" && Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (Optional.IsDefined(Server)) - { - writer.WritePropertyName("server"u8); - writer.WriteObjectValue(Server, options); - } - if (Optional.IsDefined(Permissions)) - { - writer.WritePropertyName("permissions"u8); - writer.WriteStringValue(Permissions.Value.ToString()); - } - writer.WriteEndObject(); - } - - NetAppBucketData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppBucketData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppBucketData(document.RootElement, options); - } - - internal static NetAppBucketData DeserializeNetAppBucketData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string path = default; - NetAppBucketFileSystemUser fileSystemUser = default; - NetAppProvisioningState? provisioningState = default; - NetAppBucketCredentialStatus? status = default; - NetAppBucketServerProperties server = default; - NetAppBucketPermission? permissions = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("path"u8)) - { - path = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("fileSystemUser"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fileSystemUser = NetAppBucketFileSystemUser.DeserializeNetAppBucketFileSystemUser(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = property0.Value.GetString().ToNetAppProvisioningState(); - continue; - } - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new NetAppBucketCredentialStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("server"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - server = NetAppBucketServerProperties.DeserializeNetAppBucketServerProperties(property0.Value, options); - continue; - } - if (property0.NameEquals("permissions"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - permissions = new NetAppBucketPermission(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppBucketData( - id, - name, - type, - systemData, - path, - fileSystemUser, - provisioningState, - status, - server, - permissions, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppBucketData)} does not support writing '{options.Format}' format."); - } - } - - NetAppBucketData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppBucketData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppBucketData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketData.cs deleted file mode 100644 index faaedb9e37b2..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketData.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing the NetAppBucket data model. - /// Bucket resource - /// - public partial class NetAppBucketData : ResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppBucketData() - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The volume path mounted inside the bucket. The default is the root path '/' if no value is provided when the bucket is created. - /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. - /// Provisioning state of the resource. - /// - /// The bucket credentials status. There states: - /// - /// "NoCredentialsSet": Access and Secret key pair have not been generated. - /// "CredentialsExpired": Access and Secret key pair have expired. - /// "Active": The certificate has been installed and credentials are unexpired. - /// - /// Properties of the server managing the lifecycle of volume buckets. - /// Access permissions for the bucket. Either ReadOnly or ReadWrite. The default is ReadOnly if no value is provided during bucket creation. - /// Keeps track of any properties unknown to the library. - internal NetAppBucketData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string path, NetAppBucketFileSystemUser fileSystemUser, NetAppProvisioningState? provisioningState, NetAppBucketCredentialStatus? status, NetAppBucketServerProperties server, NetAppBucketPermission? permissions, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Path = path; - FileSystemUser = fileSystemUser; - ProvisioningState = provisioningState; - Status = status; - Server = server; - Permissions = permissions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The volume path mounted inside the bucket. The default is the root path '/' if no value is provided when the bucket is created. - public string Path { get; set; } - /// File System user having access to volume data. For Unix, this is the user's uid and gid. For Windows, this is the user's username. Note that the Unix and Windows user details are mutually exclusive, meaning one or other must be supplied, but not both. - public NetAppBucketFileSystemUser FileSystemUser { get; set; } - /// Provisioning state of the resource. - public NetAppProvisioningState? ProvisioningState { get; } - /// - /// The bucket credentials status. There states: - /// - /// "NoCredentialsSet": Access and Secret key pair have not been generated. - /// "CredentialsExpired": Access and Secret key pair have expired. - /// "Active": The certificate has been installed and credentials are unexpired. - /// - public NetAppBucketCredentialStatus? Status { get; } - /// Properties of the server managing the lifecycle of volume buckets. - public NetAppBucketServerProperties Server { get; set; } - /// Access permissions for the bucket. Either ReadOnly or ReadWrite. The default is ReadOnly if no value is provided during bucket creation. - public NetAppBucketPermission? Permissions { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketResource.Serialization.cs deleted file mode 100644 index 64c05279856c..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketResource.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppBucketResource : IJsonModel - { - private static NetAppBucketData s_dataDeserializationInstance; - private static NetAppBucketData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - NetAppBucketData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); - - NetAppBucketData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketResource.cs deleted file mode 100644 index 90dfce2bfee5..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppBucketResource.cs +++ /dev/null @@ -1,434 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A Class representing a NetAppBucket along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNetAppBucketResource method. - /// Otherwise you can get one from its parent resource using the GetNetAppBucket method. - /// - public partial class NetAppBucketResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The poolName. - /// The volumeName. - /// The bucketName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _netAppBucketBucketsClientDiagnostics; - private readonly BucketsRestOperations _netAppBucketBucketsRestClient; - private readonly NetAppBucketData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/buckets"; - - /// Initializes a new instance of the class for mocking. - protected NetAppBucketResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NetAppBucketResource(ArmClient client, NetAppBucketData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NetAppBucketResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppBucketBucketsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string netAppBucketBucketsApiVersion); - _netAppBucketBucketsRestClient = new BucketsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppBucketBucketsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NetAppBucketData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketResource.Get"); - scope.Start(); - try - { - var response = await _netAppBucketBucketsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBucketResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketResource.Get"); - scope.Start(); - try - { - var response = _netAppBucketBucketsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppBucketResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a volume's bucket. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketResource.Delete"); - scope.Start(); - try - { - var response = await _netAppBucketBucketsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppBucketBucketsClientDiagnostics, Pipeline, _netAppBucketBucketsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete a volume's bucket. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketResource.Delete"); - scope.Start(); - try - { - var response = _netAppBucketBucketsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppBucketBucketsClientDiagnostics, Pipeline, _netAppBucketBucketsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Updates the details of a volume bucket. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The bucket details including user details, and the volume path that should be mounted inside the bucket. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, NetAppBucketPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketResource.Update"); - scope.Start(); - try - { - var response = await _netAppBucketBucketsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppBucketOperationSource(Client), _netAppBucketBucketsClientDiagnostics, Pipeline, _netAppBucketBucketsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Updates the details of a volume bucket. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The bucket details including user details, and the volume path that should be mounted inside the bucket. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, NetAppBucketPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketResource.Update"); - scope.Start(); - try - { - var response = _netAppBucketBucketsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new NetAppArmOperation(new NetAppBucketOperationSource(Client), _netAppBucketBucketsClientDiagnostics, Pipeline, _netAppBucketBucketsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Generate the access key and secret key used for accessing the specified volume bucket. Also return expiry date and time of key pair (in UTC). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}/generateCredentials - /// - /// - /// Operation Id - /// Buckets_GenerateCredentials - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The bucket's Access and Secret key pair expiry time expressed as the number of days from now. - /// The cancellation token to use. - /// is null. - public virtual async Task> GenerateCredentialsAsync(NetAppBucketCredentialsExpiry body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketResource.GenerateCredentials"); - scope.Start(); - try - { - var response = await _netAppBucketBucketsRestClient.GenerateCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, body, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Generate the access key and secret key used for accessing the specified volume bucket. Also return expiry date and time of key pair (in UTC). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName}/generateCredentials - /// - /// - /// Operation Id - /// Buckets_GenerateCredentials - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The bucket's Access and Secret key pair expiry time expressed as the number of days from now. - /// The cancellation token to use. - /// is null. - public virtual Response GenerateCredentials(NetAppBucketCredentialsExpiry body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - using var scope = _netAppBucketBucketsClientDiagnostics.CreateScope("NetAppBucketResource.GenerateCredentials"); - scope.Start(); - try - { - var response = _netAppBucketBucketsRestClient.GenerateCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, body, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsAccountGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsAccountGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..b6b5c8cd4bef --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsAccountGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class NetAppResourceQuotaLimitsAccountGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly NetAppResourceQuotaLimitsAccount _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of NetAppResourceQuotaLimitsAccountGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The NetAppResourceQuotaLimitsAccount client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public NetAppResourceQuotaLimitsAccountGetAllAsyncCollectionResultOfT(NetAppResourceQuotaLimitsAccount client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of NetAppResourceQuotaLimitsAccountGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of NetAppResourceQuotaLimitsAccountGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + QuotaItemList result = QuotaItemList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsAccountGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsAccountGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..2d7fb5ccf898 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsAccountGetAllCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class NetAppResourceQuotaLimitsAccountGetAllCollectionResultOfT : Pageable + { + private readonly NetAppResourceQuotaLimitsAccount _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of NetAppResourceQuotaLimitsAccountGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The NetAppResourceQuotaLimitsAccount client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public NetAppResourceQuotaLimitsAccountGetAllCollectionResultOfT(NetAppResourceQuotaLimitsAccount client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of NetAppResourceQuotaLimitsAccountGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of NetAppResourceQuotaLimitsAccountGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + QuotaItemList result = QuotaItemList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..aefb201eb61c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class NetAppResourceQuotaLimitsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly NetAppResourceQuotaLimits _client; + private readonly Guid _subscriptionId; + private readonly AzureLocation _location; + private readonly RequestContext _context; + + /// Initializes a new instance of NetAppResourceQuotaLimitsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The NetAppResourceQuotaLimits client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public NetAppResourceQuotaLimitsGetAllAsyncCollectionResultOfT(NetAppResourceQuotaLimits client, Guid subscriptionId, AzureLocation location, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _location = location; + _context = context; + } + + /// Gets the pages of NetAppResourceQuotaLimitsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of NetAppResourceQuotaLimitsGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + QuotaItemList result = QuotaItemList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _location, _context) : _client.CreateGetAllRequest(_subscriptionId, _location, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetNetAppSubscriptionQuotaItems"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..77703d4ce1d9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceQuotaLimitsGetAllCollectionResultOfT.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class NetAppResourceQuotaLimitsGetAllCollectionResultOfT : Pageable + { + private readonly NetAppResourceQuotaLimits _client; + private readonly Guid _subscriptionId; + private readonly AzureLocation _location; + private readonly RequestContext _context; + + /// Initializes a new instance of NetAppResourceQuotaLimitsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The NetAppResourceQuotaLimits client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public NetAppResourceQuotaLimitsGetAllCollectionResultOfT(NetAppResourceQuotaLimits client, Guid subscriptionId, AzureLocation location, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _location = location; + _context = context; + } + + /// Gets the pages of NetAppResourceQuotaLimitsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of NetAppResourceQuotaLimitsGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + QuotaItemList result = QuotaItemList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _location, _context) : _client.CreateGetAllRequest(_subscriptionId, _location, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetNetAppSubscriptionQuotaItems"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceUsagesGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceUsagesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..4c49c185029f --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceUsagesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class NetAppResourceUsagesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly NetAppResourceUsages _client; + private readonly Guid _subscriptionId; + private readonly string _location; + private readonly RequestContext _context; + + /// Initializes a new instance of NetAppResourceUsagesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The NetAppResourceUsages client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The location name. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public NetAppResourceUsagesGetAllAsyncCollectionResultOfT(NetAppResourceUsages client, Guid subscriptionId, string location, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + _client = client; + _subscriptionId = subscriptionId; + _location = location; + _context = context; + } + + /// Gets the pages of NetAppResourceUsagesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of NetAppResourceUsagesGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + UsagesListResult result = UsagesListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _location, _context) : _client.CreateGetAllRequest(_subscriptionId, _location, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceUsagesGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceUsagesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..33f3fc810509 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppResourceUsagesGetAllCollectionResultOfT.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class NetAppResourceUsagesGetAllCollectionResultOfT : Pageable + { + private readonly NetAppResourceUsages _client; + private readonly Guid _subscriptionId; + private readonly string _location; + private readonly RequestContext _context; + + /// Initializes a new instance of NetAppResourceUsagesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The NetAppResourceUsages client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The location name. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public NetAppResourceUsagesGetAllCollectionResultOfT(NetAppResourceUsages client, Guid subscriptionId, string location, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + _client = client; + _subscriptionId = subscriptionId; + _location = location; + _context = context; + } + + /// Gets the pages of NetAppResourceUsagesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of NetAppResourceUsagesGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + UsagesListResult result = UsagesListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _location, _context) : _client.CreateGetAllRequest(_subscriptionId, _location, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppSubscriptionResource.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemCollection.cs new file mode 100644 index 000000000000..02143e422c0b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemCollection.cs @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetNetAppSubscriptionQuotaItems method from an instance of the parent resource. + /// + public partial class NetAppSubscriptionQuotaItemCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _netAppResourceQuotaLimitsAccountClientDiagnostics; + private readonly NetAppResourceQuotaLimitsAccount _netAppResourceQuotaLimitsAccountRestClient; + private readonly ClientDiagnostics _netAppResourceQuotaLimitsClientDiagnostics; + private readonly NetAppResourceQuotaLimits _netAppResourceQuotaLimitsRestClient; + /// The accountName. + private readonly string _accountName; + + /// Initializes a new instance of NetAppSubscriptionQuotaItemCollection for mocking. + protected NetAppSubscriptionQuotaItemCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + /// The accountName for the resource. + internal NetAppSubscriptionQuotaItemCollection(ArmClient client, ResourceIdentifier id, string accountName) : base(client, id) + { + TryGetApiVersion(NetAppSubscriptionQuotaItemResource.ResourceType, out string netAppSubscriptionQuotaItemApiVersion); + _accountName = accountName; + _netAppResourceQuotaLimitsAccountClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppSubscriptionQuotaItemResource.ResourceType.Namespace, Diagnostics); + _netAppResourceQuotaLimitsAccountRestClient = new NetAppResourceQuotaLimitsAccount(_netAppResourceQuotaLimitsAccountClientDiagnostics, Pipeline, Endpoint, netAppSubscriptionQuotaItemApiVersion ?? "2025-09-01-preview"); + _netAppResourceQuotaLimitsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppSubscriptionQuotaItemResource.ResourceType.Namespace, Diagnostics); + _netAppResourceQuotaLimitsRestClient = new NetAppResourceQuotaLimits(_netAppResourceQuotaLimitsClientDiagnostics, Pipeline, Endpoint, netAppSubscriptionQuotaItemApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } + } + + /// + /// Get the default and current quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// SubscriptionQuotaItems_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + + using DiagnosticScope scope = _netAppResourceQuotaLimitsClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceQuotaLimitsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), location, quotaLimitName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetAppSubscriptionQuotaItemData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new NetAppSubscriptionQuotaItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the default and current quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// SubscriptionQuotaItems_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + + using DiagnosticScope scope = _netAppResourceQuotaLimitsClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceQuotaLimitsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), location, quotaLimitName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetAppSubscriptionQuotaItemData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new NetAppSubscriptionQuotaItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of quota limits for all quotas that are under account. Currently PoolsPerAccount is the only one. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new NetAppResourceQuotaLimitsAccountGetAllAsyncCollectionResultOfT(_netAppResourceQuotaLimitsAccountRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, _accountName, context), data => new NetAppSubscriptionQuotaItemResource(Client, data)); + } + + /// Gets a list of quota limits for all quotas that are under account. Currently PoolsPerAccount is the only one. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new NetAppResourceQuotaLimitsAccountGetAllCollectionResultOfT(_netAppResourceQuotaLimitsAccountRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, _accountName, context), data => new NetAppSubscriptionQuotaItemResource(Client, data)); + } + + /// + /// Get the default and current quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// SubscriptionQuotaItems_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + + using DiagnosticScope scope = _netAppResourceQuotaLimitsClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceQuotaLimitsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), location, quotaLimitName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(NetAppSubscriptionQuotaItemData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((NetAppSubscriptionQuotaItemData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the default and current quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// SubscriptionQuotaItems_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + + using DiagnosticScope scope = _netAppResourceQuotaLimitsClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceQuotaLimitsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), location, quotaLimitName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(NetAppSubscriptionQuotaItemData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((NetAppSubscriptionQuotaItemData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the default and current quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// SubscriptionQuotaItems_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + + using DiagnosticScope scope = _netAppResourceQuotaLimitsClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceQuotaLimitsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), location, quotaLimitName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(NetAppSubscriptionQuotaItemData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((NetAppSubscriptionQuotaItemData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new NetAppSubscriptionQuotaItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the default and current quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// SubscriptionQuotaItems_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the Azure region. + /// The name of the Quota Limit. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); + + using DiagnosticScope scope = _netAppResourceQuotaLimitsClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceQuotaLimitsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), location, quotaLimitName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(NetAppSubscriptionQuotaItemData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((NetAppSubscriptionQuotaItemData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new NetAppSubscriptionQuotaItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemData.Serialization.cs new file mode 100644 index 000000000000..570f108432d5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemData.Serialization.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Information regarding Quota Item. + public partial class NetAppSubscriptionQuotaItemData : ResourceData, IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetAppSubscriptionQuotaItemData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + NetAppSubscriptionQuotaItemData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (NetAppSubscriptionQuotaItemData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetAppSubscriptionQuotaItemData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetAppSubscriptionQuotaItemData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NetAppSubscriptionQuotaItemData DeserializeNetAppSubscriptionQuotaItemData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + QuotaItemProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = QuotaItemProperties.DeserializeQuotaItemProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new NetAppSubscriptionQuotaItemData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(NetAppSubscriptionQuotaItemData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + NetAppSubscriptionQuotaItemData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (NetAppSubscriptionQuotaItemData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeNetAppSubscriptionQuotaItemData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetAppSubscriptionQuotaItemData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static NetAppSubscriptionQuotaItemData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeNetAppSubscriptionQuotaItemData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemData.cs new file mode 100644 index 000000000000..dee05f1bef8b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemData.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Information regarding Quota Item. + public partial class NetAppSubscriptionQuotaItemData : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal NetAppSubscriptionQuotaItemData() + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// QuotaItem properties. + internal NetAppSubscriptionQuotaItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, QuotaItemProperties properties) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// QuotaItem properties. + internal QuotaItemProperties Properties { get; } + + /// The current quota value. + public int? Current + { + get + { + return Properties.Current; + } + } + + /// The default quota value. + public int? Default + { + get + { + return Properties.Default; + } + } + + /// The usage quota value. + public int? Usage + { + get + { + return Properties.Usage; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemResource.Serialization.cs new file mode 100644 index 000000000000..000a8e4819f7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class NetAppSubscriptionQuotaItemResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new NetAppSubscriptionQuotaItemData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + NetAppSubscriptionQuotaItemData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + NetAppSubscriptionQuotaItemData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemResource.cs new file mode 100644 index 000000000000..7a4c243c2179 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubscriptionQuotaItemResource.cs @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a NetAppSubscriptionQuotaItem along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetNetAppSubscriptionQuotaItems method. + /// + public partial class NetAppSubscriptionQuotaItemResource : ArmResource + { + private readonly ClientDiagnostics _netAppResourceQuotaLimitsAccountClientDiagnostics; + private readonly NetAppResourceQuotaLimitsAccount _netAppResourceQuotaLimitsAccountRestClient; + private readonly ClientDiagnostics _netAppResourceQuotaLimitsClientDiagnostics; + private readonly NetAppResourceQuotaLimits _netAppResourceQuotaLimitsRestClient; + private readonly NetAppSubscriptionQuotaItemData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/quotaLimits"; + + /// Initializes a new instance of NetAppSubscriptionQuotaItemResource for mocking. + protected NetAppSubscriptionQuotaItemResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetAppSubscriptionQuotaItemResource(ArmClient client, NetAppSubscriptionQuotaItemData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal NetAppSubscriptionQuotaItemResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string netAppSubscriptionQuotaItemApiVersion); + _netAppResourceQuotaLimitsAccountClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _netAppResourceQuotaLimitsAccountRestClient = new NetAppResourceQuotaLimitsAccount(_netAppResourceQuotaLimitsAccountClientDiagnostics, Pipeline, Endpoint, netAppSubscriptionQuotaItemApiVersion ?? "2025-09-01-preview"); + _netAppResourceQuotaLimitsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _netAppResourceQuotaLimitsRestClient = new NetAppResourceQuotaLimits(_netAppResourceQuotaLimitsClientDiagnostics, Pipeline, Endpoint, netAppSubscriptionQuotaItemApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual NetAppSubscriptionQuotaItemData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The quotaLimitName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string quotaLimitName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/quotaLimits/{quotaLimitName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the default, current and usages account quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// NetAppResourceQuotaLimitsAccount_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _netAppResourceQuotaLimitsAccountClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceQuotaLimitsAccountRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetAppSubscriptionQuotaItemData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new NetAppSubscriptionQuotaItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the default, current and usages account quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// NetAppResourceQuotaLimitsAccount_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _netAppResourceQuotaLimitsAccountClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceQuotaLimitsAccountRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetAppSubscriptionQuotaItemData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new NetAppSubscriptionQuotaItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the default and current quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// SubscriptionQuotaItems_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual async Task> GetAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _netAppResourceQuotaLimitsClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceQuotaLimitsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), location, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetAppSubscriptionQuotaItemData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new NetAppSubscriptionQuotaItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the default and current quota limit + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}. + /// + /// + /// Operation Id. + /// SubscriptionQuotaItems_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + public virtual Response Get(AzureLocation location, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _netAppResourceQuotaLimitsClientDiagnostics.CreateScope("NetAppSubscriptionQuotaItemResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceQuotaLimitsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), location, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetAppSubscriptionQuotaItemData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new NetAppSubscriptionQuotaItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoCollection.cs deleted file mode 100644 index f8ccaa870c6b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNetAppSubvolumeInfos method from an instance of . - /// - public partial class NetAppSubvolumeInfoCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _netAppSubvolumeInfoSubvolumesClientDiagnostics; - private readonly SubvolumesRestOperations _netAppSubvolumeInfoSubvolumesRestClient; - - /// Initializes a new instance of the class for mocking. - protected NetAppSubvolumeInfoCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal NetAppSubvolumeInfoCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppSubvolumeInfoSubvolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppSubvolumeInfoResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppSubvolumeInfoResource.ResourceType, out string netAppSubvolumeInfoSubvolumesApiVersion); - _netAppSubvolumeInfoSubvolumesRestClient = new SubvolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppSubvolumeInfoSubvolumesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != NetAppVolumeResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetAppVolumeResource.ResourceType), nameof(id)); - } - - /// - /// Creates a subvolume in the path or clones the subvolume mentioned in the parentPath - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the subvolume. - /// Subvolume object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string subvolumeName, NetAppSubvolumeInfoData info, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - Argument.AssertNotNull(info, nameof(info)); - - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _netAppSubvolumeInfoSubvolumesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, info, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppSubvolumeInfoOperationSource(Client), _netAppSubvolumeInfoSubvolumesClientDiagnostics, Pipeline, _netAppSubvolumeInfoSubvolumesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, info).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates a subvolume in the path or clones the subvolume mentioned in the parentPath - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the subvolume. - /// Subvolume object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string subvolumeName, NetAppSubvolumeInfoData info, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - Argument.AssertNotNull(info, nameof(info)); - - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _netAppSubvolumeInfoSubvolumesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, info, cancellationToken); - var operation = new NetAppArmOperation(new NetAppSubvolumeInfoOperationSource(Client), _netAppSubvolumeInfoSubvolumesClientDiagnostics, Pipeline, _netAppSubvolumeInfoSubvolumesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, info).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns the path associated with the subvolumeName provided - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the subvolume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoCollection.Get"); - scope.Start(); - try - { - var response = await _netAppSubvolumeInfoSubvolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppSubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns the path associated with the subvolumeName provided - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the subvolume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoCollection.Get"); - scope.Start(); - try - { - var response = _netAppSubvolumeInfoSubvolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppSubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns a list of the subvolumes in the volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes - /// - /// - /// Operation Id - /// Subvolumes_ListByVolume - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppSubvolumeInfoSubvolumesRestClient.CreateListByVolumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppSubvolumeInfoSubvolumesRestClient.CreateListByVolumeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetAppSubvolumeInfoResource(Client, NetAppSubvolumeInfoData.DeserializeNetAppSubvolumeInfoData(e)), _netAppSubvolumeInfoSubvolumesClientDiagnostics, Pipeline, "NetAppSubvolumeInfoCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Returns a list of the subvolumes in the volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes - /// - /// - /// Operation Id - /// Subvolumes_ListByVolume - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppSubvolumeInfoSubvolumesRestClient.CreateListByVolumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppSubvolumeInfoSubvolumesRestClient.CreateListByVolumeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetAppSubvolumeInfoResource(Client, NetAppSubvolumeInfoData.DeserializeNetAppSubvolumeInfoData(e)), _netAppSubvolumeInfoSubvolumesClientDiagnostics, Pipeline, "NetAppSubvolumeInfoCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the subvolume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoCollection.Exists"); - scope.Start(); - try - { - var response = await _netAppSubvolumeInfoSubvolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the subvolume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoCollection.Exists"); - scope.Start(); - try - { - var response = _netAppSubvolumeInfoSubvolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the subvolume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _netAppSubvolumeInfoSubvolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppSubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the subvolume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoCollection.GetIfExists"); - scope.Start(); - try - { - var response = _netAppSubvolumeInfoSubvolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppSubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoData.Serialization.cs deleted file mode 100644 index 9ec227158ffa..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoData.Serialization.cs +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppSubvolumeInfoData : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppSubvolumeInfoData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Path)) - { - writer.WritePropertyName("path"u8); - writer.WriteStringValue(Path); - } - if (Optional.IsDefined(Size)) - { - if (Size != null) - { - writer.WritePropertyName("size"u8); - writer.WriteNumberValue(Size.Value); - } - else - { - writer.WriteNull("size"); - } - } - if (Optional.IsDefined(ParentPath)) - { - if (ParentPath != null) - { - writer.WritePropertyName("parentPath"u8); - writer.WriteStringValue(ParentPath); - } - else - { - writer.WriteNull("parentPath"); - } - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - writer.WriteEndObject(); - } - - NetAppSubvolumeInfoData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppSubvolumeInfoData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppSubvolumeInfoData(document.RootElement, options); - } - - internal static NetAppSubvolumeInfoData DeserializeNetAppSubvolumeInfoData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string path = default; - long? size = default; - string parentPath = default; - string provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("path"u8)) - { - path = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("size"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - size = null; - continue; - } - size = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("parentPath"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - parentPath = null; - continue; - } - parentPath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppSubvolumeInfoData( - id, - name, - type, - systemData, - path, - size, - parentPath, - provisioningState, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppSubvolumeInfoData)} does not support writing '{options.Format}' format."); - } - } - - NetAppSubvolumeInfoData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppSubvolumeInfoData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppSubvolumeInfoData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoData.cs deleted file mode 100644 index ef117a59f328..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoData.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing the NetAppSubvolumeInfo data model. - /// Subvolume Information properties - /// - public partial class NetAppSubvolumeInfoData : ResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppSubvolumeInfoData() - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Path to the subvolume. - /// Truncate subvolume to the provided size in bytes. - /// parent path to the subvolume. - /// Azure lifecycle management. - /// Keeps track of any properties unknown to the library. - internal NetAppSubvolumeInfoData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string path, long? size, string parentPath, string provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Path = path; - Size = size; - ParentPath = parentPath; - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Path to the subvolume. - public string Path { get; set; } - /// Truncate subvolume to the provided size in bytes. - public long? Size { get; set; } - /// parent path to the subvolume. - public string ParentPath { get; set; } - /// Azure lifecycle management. - public string ProvisioningState { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.Serialization.cs deleted file mode 100644 index 180356e23b8f..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppSubvolumeInfoResource : IJsonModel - { - private static NetAppSubvolumeInfoData s_dataDeserializationInstance; - private static NetAppSubvolumeInfoData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - NetAppSubvolumeInfoData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); - - NetAppSubvolumeInfoData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.cs deleted file mode 100644 index 6cab514da01b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppSubvolumeInfoResource.cs +++ /dev/null @@ -1,434 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A Class representing a NetAppSubvolumeInfo along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNetAppSubvolumeInfoResource method. - /// Otherwise you can get one from its parent resource using the GetNetAppSubvolumeInfo method. - /// - public partial class NetAppSubvolumeInfoResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The poolName. - /// The volumeName. - /// The subvolumeName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _netAppSubvolumeInfoSubvolumesClientDiagnostics; - private readonly SubvolumesRestOperations _netAppSubvolumeInfoSubvolumesRestClient; - private readonly NetAppSubvolumeInfoData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/subvolumes"; - - /// Initializes a new instance of the class for mocking. - protected NetAppSubvolumeInfoResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NetAppSubvolumeInfoResource(ArmClient client, NetAppSubvolumeInfoData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NetAppSubvolumeInfoResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppSubvolumeInfoSubvolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string netAppSubvolumeInfoSubvolumesApiVersion); - _netAppSubvolumeInfoSubvolumesRestClient = new SubvolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppSubvolumeInfoSubvolumesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NetAppSubvolumeInfoData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Returns the path associated with the subvolumeName provided - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoResource.Get"); - scope.Start(); - try - { - var response = await _netAppSubvolumeInfoSubvolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppSubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns the path associated with the subvolumeName provided - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoResource.Get"); - scope.Start(); - try - { - var response = _netAppSubvolumeInfoSubvolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppSubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete subvolume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoResource.Delete"); - scope.Start(); - try - { - var response = await _netAppSubvolumeInfoSubvolumesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppSubvolumeInfoSubvolumesClientDiagnostics, Pipeline, _netAppSubvolumeInfoSubvolumesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete subvolume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoResource.Delete"); - scope.Start(); - try - { - var response = _netAppSubvolumeInfoSubvolumesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppSubvolumeInfoSubvolumesClientDiagnostics, Pipeline, _netAppSubvolumeInfoSubvolumesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch a subvolume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Subvolume object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, NetAppSubvolumeInfoPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoResource.Update"); - scope.Start(); - try - { - var response = await _netAppSubvolumeInfoSubvolumesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppSubvolumeInfoOperationSource(Client), _netAppSubvolumeInfoSubvolumesClientDiagnostics, Pipeline, _netAppSubvolumeInfoSubvolumesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch a subvolume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Subvolume object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, NetAppSubvolumeInfoPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoResource.Update"); - scope.Start(); - try - { - var response = _netAppSubvolumeInfoSubvolumesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new NetAppArmOperation(new NetAppSubvolumeInfoOperationSource(Client), _netAppSubvolumeInfoSubvolumesClientDiagnostics, Pipeline, _netAppSubvolumeInfoSubvolumesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified subvolume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata - /// - /// - /// Operation Id - /// Subvolumes_GetMetadata - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task> GetMetadataAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoResource.GetMetadata"); - scope.Start(); - try - { - var response = await _netAppSubvolumeInfoSubvolumesRestClient.GetMetadataAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppSubvolumeMetadataOperationSource(), _netAppSubvolumeInfoSubvolumesClientDiagnostics, Pipeline, _netAppSubvolumeInfoSubvolumesRestClient.CreateGetMetadataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified subvolume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata - /// - /// - /// Operation Id - /// Subvolumes_GetMetadata - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation GetMetadata(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppSubvolumeInfoSubvolumesClientDiagnostics.CreateScope("NetAppSubvolumeInfoResource.GetMetadata"); - scope.Start(); - try - { - var response = _netAppSubvolumeInfoSubvolumesRestClient.GetMetadata(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(new NetAppSubvolumeMetadataOperationSource(), _netAppSubvolumeInfoSubvolumesClientDiagnostics, Pipeline, _netAppSubvolumeInfoSubvolumesRestClient.CreateGetMetadataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeCollection.cs deleted file mode 100644 index 983a692b9191..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNetAppVolumes method from an instance of . - /// - public partial class NetAppVolumeCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _netAppVolumeVolumesClientDiagnostics; - private readonly VolumesRestOperations _netAppVolumeVolumesRestClient; - - /// Initializes a new instance of the class for mocking. - protected NetAppVolumeCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal NetAppVolumeCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppVolumeVolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppVolumeResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppVolumeResource.ResourceType, out string netAppVolumeVolumesApiVersion); - _netAppVolumeVolumesRestClient = new VolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppVolumeVolumesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != CapacityPoolResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, CapacityPoolResource.ResourceType), nameof(id)); - } - - /// - /// Create or update the specified volume within the capacity pool - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the volume. - /// Volume object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string volumeName, NetAppVolumeData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeOperationSource(Client), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create or update the specified volume within the capacity pool - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the volume. - /// Volume object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string volumeName, NetAppVolumeData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeOperationSource(Client), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the details of the specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeCollection.Get"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the details of the specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeCollection.Get"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all volumes within the capacity pool - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes - /// - /// - /// Operation Id - /// Volumes_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppVolumeVolumesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppVolumeVolumesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetAppVolumeResource(Client, NetAppVolumeData.DeserializeNetAppVolumeData(e)), _netAppVolumeVolumesClientDiagnostics, Pipeline, "NetAppVolumeCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// List all volumes within the capacity pool - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes - /// - /// - /// Operation Id - /// Volumes_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppVolumeVolumesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _netAppVolumeVolumesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetAppVolumeResource(Client, NetAppVolumeData.DeserializeNetAppVolumeData(e)), _netAppVolumeVolumesClientDiagnostics, Pipeline, "NetAppVolumeCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeCollection.Exists"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeCollection.Exists"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volume. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeCollection.GetIfExists"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeData.Serialization.cs deleted file mode 100644 index 3a1721520f76..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeData.Serialization.cs +++ /dev/null @@ -1,1275 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppVolumeData : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (options.Format != "W" && Optional.IsDefined(ETag)) - { - writer.WritePropertyName("etag"u8); - writer.WriteStringValue(ETag.Value.ToString()); - } - if (Optional.IsCollectionDefined(Zones)) - { - writer.WritePropertyName("zones"u8); - writer.WriteStartArray(); - foreach (var item in Zones) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(IsRestoring)) - { - writer.WritePropertyName("isRestoring"u8); - writer.WriteBooleanValue(IsRestoring.Value); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(FileSystemId)) - { - writer.WritePropertyName("fileSystemId"u8); - writer.WriteStringValue(FileSystemId.Value); - } - writer.WritePropertyName("creationToken"u8); - writer.WriteStringValue(CreationToken); - if (Optional.IsDefined(ServiceLevel)) - { - writer.WritePropertyName("serviceLevel"u8); - writer.WriteStringValue(ServiceLevel.Value.ToString()); - } - writer.WritePropertyName("usageThreshold"u8); - writer.WriteNumberValue(UsageThreshold); - if (Optional.IsDefined(ExportPolicy)) - { - writer.WritePropertyName("exportPolicy"u8); - writer.WriteObjectValue(ExportPolicy, options); - } - if (Optional.IsCollectionDefined(ProtocolTypes)) - { - writer.WritePropertyName("protocolTypes"u8); - writer.WriteStartArray(); - foreach (var item in ProtocolTypes) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsDefined(SnapshotId)) - { - if (SnapshotId != null) - { - writer.WritePropertyName("snapshotId"u8); - writer.WriteStringValue(SnapshotId); - } - else - { - writer.WriteNull("snapshotId"); - } - } - if (Optional.IsDefined(DeleteBaseSnapshot)) - { - writer.WritePropertyName("deleteBaseSnapshot"u8); - writer.WriteBooleanValue(DeleteBaseSnapshot.Value); - } - if (Optional.IsDefined(BackupId)) - { - if (BackupId != null) - { - writer.WritePropertyName("backupId"u8); - writer.WriteStringValue(BackupId); - } - else - { - writer.WriteNull("backupId"); - } - } - if (options.Format != "W" && Optional.IsDefined(BaremetalTenantId)) - { - writer.WritePropertyName("baremetalTenantId"u8); - writer.WriteStringValue(BaremetalTenantId); - } - writer.WritePropertyName("subnetId"u8); - writer.WriteStringValue(SubnetId); - if (Optional.IsDefined(NetworkFeatures)) - { - writer.WritePropertyName("networkFeatures"u8); - writer.WriteStringValue(NetworkFeatures.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(EffectiveNetworkFeatures)) - { - writer.WritePropertyName("effectiveNetworkFeatures"u8); - writer.WriteStringValue(EffectiveNetworkFeatures.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(NetworkSiblingSetId)) - { - writer.WritePropertyName("networkSiblingSetId"u8); - writer.WriteStringValue(NetworkSiblingSetId.Value); - } - if (options.Format != "W" && Optional.IsDefined(StorageToNetworkProximity)) - { - writer.WritePropertyName("storageToNetworkProximity"u8); - writer.WriteStringValue(StorageToNetworkProximity.Value.ToString()); - } - if (options.Format != "W" && Optional.IsCollectionDefined(MountTargets)) - { - writer.WritePropertyName("mountTargets"u8); - writer.WriteStartArray(); - foreach (var item in MountTargets) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(VolumeType)) - { - writer.WritePropertyName("volumeType"u8); - writer.WriteStringValue(VolumeType); - } - if (Optional.IsDefined(DataProtection)) - { - writer.WritePropertyName("dataProtection"u8); - writer.WriteObjectValue(DataProtection, options); - } - if (Optional.IsDefined(AcceptGrowCapacityPoolForShortTermCloneSplit)) - { - writer.WritePropertyName("acceptGrowCapacityPoolForShortTermCloneSplit"u8); - writer.WriteStringValue(AcceptGrowCapacityPoolForShortTermCloneSplit.Value.ToString()); - } - if (Optional.IsDefined(IsSnapshotDirectoryVisible)) - { - writer.WritePropertyName("snapshotDirectoryVisible"u8); - writer.WriteBooleanValue(IsSnapshotDirectoryVisible.Value); - } - if (Optional.IsDefined(IsKerberosEnabled)) - { - writer.WritePropertyName("kerberosEnabled"u8); - writer.WriteBooleanValue(IsKerberosEnabled.Value); - } - if (Optional.IsDefined(SecurityStyle)) - { - writer.WritePropertyName("securityStyle"u8); - writer.WriteStringValue(SecurityStyle.Value.ToString()); - } - if (Optional.IsDefined(IsSmbEncryptionEnabled)) - { - writer.WritePropertyName("smbEncryption"u8); - writer.WriteBooleanValue(IsSmbEncryptionEnabled.Value); - } - if (Optional.IsDefined(SmbAccessBasedEnumeration)) - { - if (SmbAccessBasedEnumeration != null) - { - writer.WritePropertyName("smbAccessBasedEnumeration"u8); - writer.WriteStringValue(SmbAccessBasedEnumeration.Value.ToString()); - } - else - { - writer.WriteNull("smbAccessBasedEnumeration"); - } - } - if (Optional.IsDefined(SmbNonBrowsable)) - { - writer.WritePropertyName("smbNonBrowsable"u8); - writer.WriteStringValue(SmbNonBrowsable.Value.ToString()); - } - if (Optional.IsDefined(IsSmbContinuouslyAvailable)) - { - writer.WritePropertyName("smbContinuouslyAvailable"u8); - writer.WriteBooleanValue(IsSmbContinuouslyAvailable.Value); - } - if (Optional.IsDefined(ThroughputMibps)) - { - if (ThroughputMibps != null) - { - writer.WritePropertyName("throughputMibps"u8); - writer.WriteNumberValue(ThroughputMibps.Value); - } - else - { - writer.WriteNull("throughputMibps"); - } - } - if (options.Format != "W" && Optional.IsDefined(ActualThroughputMibps)) - { - writer.WritePropertyName("actualThroughputMibps"u8); - writer.WriteNumberValue(ActualThroughputMibps.Value); - } - if (Optional.IsDefined(EncryptionKeySource)) - { - writer.WritePropertyName("encryptionKeySource"u8); - writer.WriteStringValue(EncryptionKeySource.Value.ToString()); - } - if (Optional.IsDefined(KeyVaultPrivateEndpointResourceId)) - { - writer.WritePropertyName("keyVaultPrivateEndpointResourceId"u8); - writer.WriteStringValue(KeyVaultPrivateEndpointResourceId); - } - if (Optional.IsDefined(IsLdapEnabled)) - { - writer.WritePropertyName("ldapEnabled"u8); - writer.WriteBooleanValue(IsLdapEnabled.Value); - } - if (Optional.IsDefined(LdapServerType)) - { - if (LdapServerType != null) - { - writer.WritePropertyName("ldapServerType"u8); - writer.WriteStringValue(LdapServerType.Value.ToString()); - } - else - { - writer.WriteNull("ldapServerType"); - } - } - if (Optional.IsDefined(IsCoolAccessEnabled)) - { - writer.WritePropertyName("coolAccess"u8); - writer.WriteBooleanValue(IsCoolAccessEnabled.Value); - } - if (Optional.IsDefined(CoolnessPeriod)) - { - writer.WritePropertyName("coolnessPeriod"u8); - writer.WriteNumberValue(CoolnessPeriod.Value); - } - if (Optional.IsDefined(CoolAccessRetrievalPolicy)) - { - writer.WritePropertyName("coolAccessRetrievalPolicy"u8); - writer.WriteStringValue(CoolAccessRetrievalPolicy.Value.ToString()); - } - if (Optional.IsDefined(CoolAccessTieringPolicy)) - { - writer.WritePropertyName("coolAccessTieringPolicy"u8); - writer.WriteStringValue(CoolAccessTieringPolicy.Value.ToString()); - } - if (Optional.IsDefined(UnixPermissions)) - { - if (UnixPermissions != null) - { - writer.WritePropertyName("unixPermissions"u8); - writer.WriteStringValue(UnixPermissions); - } - else - { - writer.WriteNull("unixPermissions"); - } - } - if (options.Format != "W" && Optional.IsDefined(CloneProgress)) - { - if (CloneProgress != null) - { - writer.WritePropertyName("cloneProgress"u8); - writer.WriteNumberValue(CloneProgress.Value); - } - else - { - writer.WriteNull("cloneProgress"); - } - } - if (options.Format != "W" && Optional.IsDefined(FileAccessLogs)) - { - writer.WritePropertyName("fileAccessLogs"u8); - writer.WriteStringValue(FileAccessLogs.Value.ToString()); - } - if (Optional.IsDefined(AvsDataStore)) - { - writer.WritePropertyName("avsDataStore"u8); - writer.WriteStringValue(AvsDataStore.Value.ToString()); - } - if (options.Format != "W" && Optional.IsCollectionDefined(DataStoreResourceId)) - { - writer.WritePropertyName("dataStoreResourceId"u8); - writer.WriteStartArray(); - foreach (var item in DataStoreResourceId) - { - if (item == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(IsDefaultQuotaEnabled)) - { - writer.WritePropertyName("isDefaultQuotaEnabled"u8); - writer.WriteBooleanValue(IsDefaultQuotaEnabled.Value); - } - if (Optional.IsDefined(DefaultUserQuotaInKiBs)) - { - writer.WritePropertyName("defaultUserQuotaInKiBs"u8); - writer.WriteNumberValue(DefaultUserQuotaInKiBs.Value); - } - if (Optional.IsDefined(DefaultGroupQuotaInKiBs)) - { - writer.WritePropertyName("defaultGroupQuotaInKiBs"u8); - writer.WriteNumberValue(DefaultGroupQuotaInKiBs.Value); - } - if (options.Format != "W" && Optional.IsDefined(MaximumNumberOfFiles)) - { - writer.WritePropertyName("maximumNumberOfFiles"u8); - writer.WriteNumberValue(MaximumNumberOfFiles.Value); - } - if (options.Format != "W" && Optional.IsDefined(VolumeGroupName)) - { - writer.WritePropertyName("volumeGroupName"u8); - writer.WriteStringValue(VolumeGroupName); - } - if (Optional.IsDefined(CapacityPoolResourceId)) - { - writer.WritePropertyName("capacityPoolResourceId"u8); - writer.WriteStringValue(CapacityPoolResourceId); - } - if (Optional.IsDefined(ProximityPlacementGroupId)) - { - writer.WritePropertyName("proximityPlacementGroup"u8); - writer.WriteStringValue(ProximityPlacementGroupId); - } - if (options.Format != "W" && Optional.IsDefined(T2Network)) - { - writer.WritePropertyName("t2Network"u8); - writer.WriteStringValue(T2Network); - } - if (Optional.IsDefined(VolumeSpecName)) - { - writer.WritePropertyName("volumeSpecName"u8); - writer.WriteStringValue(VolumeSpecName); - } - if (options.Format != "W" && Optional.IsDefined(IsEncrypted)) - { - writer.WritePropertyName("encrypted"u8); - writer.WriteBooleanValue(IsEncrypted.Value); - } - if (Optional.IsCollectionDefined(PlacementRules)) - { - writer.WritePropertyName("placementRules"u8); - writer.WriteStartArray(); - foreach (var item in PlacementRules) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(EnableSubvolumes)) - { - writer.WritePropertyName("enableSubvolumes"u8); - writer.WriteStringValue(EnableSubvolumes.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(ProvisionedAvailabilityZone)) - { - if (ProvisionedAvailabilityZone != null) - { - writer.WritePropertyName("provisionedAvailabilityZone"u8); - writer.WriteStringValue(ProvisionedAvailabilityZone); - } - else - { - writer.WriteNull("provisionedAvailabilityZone"); - } - } - if (Optional.IsDefined(IsLargeVolume)) - { - writer.WritePropertyName("isLargeVolume"u8); - writer.WriteBooleanValue(IsLargeVolume.Value); - } - if (options.Format != "W" && Optional.IsDefined(OriginatingResourceId)) - { - if (OriginatingResourceId != null) - { - writer.WritePropertyName("originatingResourceId"u8); - writer.WriteStringValue(OriginatingResourceId); - } - else - { - writer.WriteNull("originatingResourceId"); - } - } - if (options.Format != "W" && Optional.IsDefined(InheritedSizeInBytes)) - { - if (InheritedSizeInBytes != null) - { - writer.WritePropertyName("inheritedSizeInBytes"u8); - writer.WriteNumberValue(InheritedSizeInBytes.Value); - } - else - { - writer.WriteNull("inheritedSizeInBytes"); - } - } - if (Optional.IsDefined(Language)) - { - if (Language != null) - { - writer.WritePropertyName("language"u8); - writer.WriteStringValue(Language.Value.ToString()); - } - else - { - writer.WriteNull("language"); - } - } - writer.WriteEndObject(); - } - - NetAppVolumeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeData(document.RootElement, options); - } - - internal static NetAppVolumeData DeserializeNetAppVolumeData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ETag? etag = default; - IList zones = default; - bool? isRestoring = default; - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - Guid? fileSystemId = default; - string creationToken = default; - NetAppFileServiceLevel? serviceLevel = default; - long usageThreshold = default; - VolumePropertiesExportPolicy exportPolicy = default; - IList protocolTypes = default; - string provisioningState = default; - string snapshotId = default; - bool? deleteBaseSnapshot = default; - string backupId = default; - string baremetalTenantId = default; - ResourceIdentifier subnetId = default; - NetAppNetworkFeature? networkFeatures = default; - NetAppNetworkFeature? effectiveNetworkFeatures = default; - Guid? networkSiblingSetId = default; - NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity = default; - IReadOnlyList mountTargets = default; - string volumeType = default; - NetAppVolumeDataProtection dataProtection = default; - AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit = default; - bool? snapshotDirectoryVisible = default; - bool? kerberosEnabled = default; - NetAppVolumeSecurityStyle? securityStyle = default; - bool? smbEncryption = default; - SmbAccessBasedEnumeration? smbAccessBasedEnumeration = default; - SmbNonBrowsable? smbNonBrowsable = default; - bool? smbContinuouslyAvailable = default; - float? throughputMibps = default; - float? actualThroughputMibps = default; - NetAppEncryptionKeySource? encryptionKeySource = default; - ResourceIdentifier keyVaultPrivateEndpointResourceId = default; - bool? ldapEnabled = default; - LdapServerType? ldapServerType = default; - bool? coolAccess = default; - int? coolnessPeriod = default; - CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy = default; - CoolAccessTieringPolicy? coolAccessTieringPolicy = default; - string unixPermissions = default; - int? cloneProgress = default; - NetAppFileAccessLog? fileAccessLogs = default; - NetAppAvsDataStore? avsDataStore = default; - IReadOnlyList dataStoreResourceId = default; - bool? isDefaultQuotaEnabled = default; - long? defaultUserQuotaInKiBs = default; - long? defaultGroupQuotaInKiBs = default; - long? maximumNumberOfFiles = default; - string volumeGroupName = default; - ResourceIdentifier capacityPoolResourceId = default; - ResourceIdentifier proximityPlacementGroup = default; - string t2Network = default; - string volumeSpecName = default; - bool? encrypted = default; - IList placementRules = default; - EnableNetAppSubvolume? enableSubvolumes = default; - string provisionedAvailabilityZone = default; - bool? isLargeVolume = default; - ResourceIdentifier originatingResourceId = default; - long? inheritedSizeInBytes = default; - NetAppVolumeLanguage? language = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("etag"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - etag = new ETag(property.Value.GetString()); - continue; - } - if (property.NameEquals("zones"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - zones = array; - continue; - } - if (property.NameEquals("isRestoring"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isRestoring = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("fileSystemId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fileSystemId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("creationToken"u8)) - { - creationToken = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("serviceLevel"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - serviceLevel = new NetAppFileServiceLevel(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("usageThreshold"u8)) - { - usageThreshold = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("exportPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exportPolicy = VolumePropertiesExportPolicy.DeserializeVolumePropertiesExportPolicy(property0.Value, options); - continue; - } - if (property0.NameEquals("protocolTypes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - protocolTypes = array; - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("snapshotId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - snapshotId = null; - continue; - } - snapshotId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("deleteBaseSnapshot"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - deleteBaseSnapshot = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("backupId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - backupId = null; - continue; - } - backupId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("baremetalTenantId"u8)) - { - baremetalTenantId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("subnetId"u8)) - { - subnetId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("networkFeatures"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkFeatures = new NetAppNetworkFeature(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("effectiveNetworkFeatures"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - effectiveNetworkFeatures = new NetAppNetworkFeature(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("networkSiblingSetId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkSiblingSetId = property0.Value.GetGuid(); - continue; - } - if (property0.NameEquals("storageToNetworkProximity"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - storageToNetworkProximity = new NetAppVolumeStorageToNetworkProximity(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("mountTargets"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(NetAppVolumeMountTarget.DeserializeNetAppVolumeMountTarget(item, options)); - } - mountTargets = array; - continue; - } - if (property0.NameEquals("volumeType"u8)) - { - volumeType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("dataProtection"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dataProtection = NetAppVolumeDataProtection.DeserializeNetAppVolumeDataProtection(property0.Value, options); - continue; - } - if (property0.NameEquals("acceptGrowCapacityPoolForShortTermCloneSplit"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - acceptGrowCapacityPoolForShortTermCloneSplit = new AcceptGrowCapacityPoolForShortTermCloneSplit(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("snapshotDirectoryVisible"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - snapshotDirectoryVisible = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("kerberosEnabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kerberosEnabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("securityStyle"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - securityStyle = new NetAppVolumeSecurityStyle(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("smbEncryption"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - smbEncryption = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("smbAccessBasedEnumeration"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - smbAccessBasedEnumeration = null; - continue; - } - smbAccessBasedEnumeration = new SmbAccessBasedEnumeration(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("smbNonBrowsable"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - smbNonBrowsable = new SmbNonBrowsable(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("smbContinuouslyAvailable"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - smbContinuouslyAvailable = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("throughputMibps"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - throughputMibps = null; - continue; - } - throughputMibps = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("actualThroughputMibps"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - actualThroughputMibps = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("encryptionKeySource"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - encryptionKeySource = new NetAppEncryptionKeySource(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("keyVaultPrivateEndpointResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultPrivateEndpointResourceId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("ldapEnabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - ldapEnabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("ldapServerType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - ldapServerType = null; - continue; - } - ldapServerType = new LdapServerType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("coolAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccess = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("coolnessPeriod"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolnessPeriod = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("coolAccessRetrievalPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccessRetrievalPolicy = new CoolAccessRetrievalPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("coolAccessTieringPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - coolAccessTieringPolicy = new CoolAccessTieringPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("unixPermissions"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - unixPermissions = null; - continue; - } - unixPermissions = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("cloneProgress"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - cloneProgress = null; - continue; - } - cloneProgress = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("fileAccessLogs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fileAccessLogs = new NetAppFileAccessLog(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("avsDataStore"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - avsDataStore = new NetAppAvsDataStore(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("dataStoreResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(new ResourceIdentifier(item.GetString())); - } - } - dataStoreResourceId = array; - continue; - } - if (property0.NameEquals("isDefaultQuotaEnabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isDefaultQuotaEnabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("defaultUserQuotaInKiBs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - defaultUserQuotaInKiBs = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("defaultGroupQuotaInKiBs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - defaultGroupQuotaInKiBs = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("maximumNumberOfFiles"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maximumNumberOfFiles = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("volumeGroupName"u8)) - { - volumeGroupName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("capacityPoolResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - capacityPoolResourceId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("proximityPlacementGroup"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - proximityPlacementGroup = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("t2Network"u8)) - { - t2Network = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("volumeSpecName"u8)) - { - volumeSpecName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("encrypted"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - encrypted = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("placementRules"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(NetAppVolumePlacementRule.DeserializeNetAppVolumePlacementRule(item, options)); - } - placementRules = array; - continue; - } - if (property0.NameEquals("enableSubvolumes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableSubvolumes = new EnableNetAppSubvolume(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisionedAvailabilityZone"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - provisionedAvailabilityZone = null; - continue; - } - provisionedAvailabilityZone = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("isLargeVolume"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isLargeVolume = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("originatingResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - originatingResourceId = null; - continue; - } - originatingResourceId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("inheritedSizeInBytes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - inheritedSizeInBytes = null; - continue; - } - inheritedSizeInBytes = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("language"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - language = null; - continue; - } - language = new NetAppVolumeLanguage(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeData( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - etag, - zones ?? new ChangeTrackingList(), - fileSystemId, - creationToken, - serviceLevel, - usageThreshold, - exportPolicy, - protocolTypes ?? new ChangeTrackingList(), - provisioningState, - snapshotId, - deleteBaseSnapshot, - backupId, - baremetalTenantId, - subnetId, - networkFeatures, - effectiveNetworkFeatures, - networkSiblingSetId, - storageToNetworkProximity, - mountTargets ?? new ChangeTrackingList(), - volumeType, - dataProtection, - acceptGrowCapacityPoolForShortTermCloneSplit, - isRestoring, - snapshotDirectoryVisible, - kerberosEnabled, - securityStyle, - smbEncryption, - smbAccessBasedEnumeration, - smbNonBrowsable, - smbContinuouslyAvailable, - throughputMibps, - actualThroughputMibps, - encryptionKeySource, - keyVaultPrivateEndpointResourceId, - ldapEnabled, - ldapServerType, - coolAccess, - coolnessPeriod, - coolAccessRetrievalPolicy, - coolAccessTieringPolicy, - unixPermissions, - cloneProgress, - fileAccessLogs, - avsDataStore, - dataStoreResourceId ?? new ChangeTrackingList(), - isDefaultQuotaEnabled, - defaultUserQuotaInKiBs, - defaultGroupQuotaInKiBs, - maximumNumberOfFiles, - volumeGroupName, - capacityPoolResourceId, - proximityPlacementGroup, - t2Network, - volumeSpecName, - encrypted, - placementRules ?? new ChangeTrackingList(), - enableSubvolumes, - provisionedAvailabilityZone, - isLargeVolume, - originatingResourceId, - inheritedSizeInBytes, - language, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeData)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeData.cs deleted file mode 100644 index 315df9560eaa..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeData.cs +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing the NetAppVolume data model. - /// Volume resource - /// - public partial class NetAppVolumeData : TrackedResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The location. - /// A unique file path for the volume. Used when creating mount targets. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// or is null. - public NetAppVolumeData(AzureLocation location, string creationToken, long usageThreshold, ResourceIdentifier subnetId) : base(location) - { - Argument.AssertNotNull(creationToken, nameof(creationToken)); - Argument.AssertNotNull(subnetId, nameof(subnetId)); - - Zones = new ChangeTrackingList(); - CreationToken = creationToken; - UsageThreshold = usageThreshold; - ProtocolTypes = new ChangeTrackingList(); - SubnetId = subnetId; - MountTargets = new ChangeTrackingList(); - DataStoreResourceId = new ChangeTrackingList(); - PlacementRules = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// Availability Zone. - /// Unique FileSystem Identifier. - /// A unique file path for the volume. Used when creating mount targets. - /// The service level of the file system. - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - /// Set of export policy rules. - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - /// Azure lifecycle management. - /// Resource identifier used to identify the Snapshot. - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - /// Resource identifier used to identify the Backup. - /// Unique Baremetal Tenant Identifier. - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - /// The original value of the network features type available to the volume at the time it was created. - /// The effective value of the network features type available to the volume, or current effective state of update. - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - /// Provides storage to network proximity information for the volume. - /// List of mount targets. - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. For creating clone volume, set type to ShortTermClone. - /// DataProtection type volumes include an object containing details of the replication. - /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. - /// Restoring. - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - /// Specifies whether LDAP is enabled or not for a given NFS volume. - /// Specifies the type of LDAP server for a given NFS volume. - /// Specifies whether Cool Access(tiering) is enabled for the volume. - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. Avoid passing null value for unixPermissions in volume update operation, As per the behavior, If Null value is passed then user-visible unixPermissions value will became null, and user will not be able to get unixPermissions value. On safer side, actual unixPermissions value on volume will remain as its last saved value only. - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - /// Data store resource unique identifier. - /// Specifies if default quota is enabled for the volume. - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - /// Volume Group Name. - /// Pool Resource Id used in case of creating a volume through volume group. - /// Proximity placement group associated with the volume. - /// T2 network information. - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - /// Application specific placement rules for the particular volume. - /// Flag indicating whether subvolume operations are enabled on the volume. - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - /// Specifies whether volume is a Large Volume or Regular Volume. - /// Id of the snapshot or backup that the volume is restored from. - /// Space shared by short term clone volume with parent volume in bytes. - /// Language supported for volume. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, IList zones, Guid? fileSystemId, string creationToken, NetAppFileServiceLevel? serviceLevel, long usageThreshold, VolumePropertiesExportPolicy exportPolicy, IList protocolTypes, string provisioningState, string snapshotId, bool? deleteBaseSnapshot, string backupId, string baremetalTenantId, ResourceIdentifier subnetId, NetAppNetworkFeature? networkFeatures, NetAppNetworkFeature? effectiveNetworkFeatures, Guid? networkSiblingSetId, NetAppVolumeStorageToNetworkProximity? storageToNetworkProximity, IReadOnlyList mountTargets, string volumeType, NetAppVolumeDataProtection dataProtection, AcceptGrowCapacityPoolForShortTermCloneSplit? acceptGrowCapacityPoolForShortTermCloneSplit, bool? isRestoring, bool? isSnapshotDirectoryVisible, bool? isKerberosEnabled, NetAppVolumeSecurityStyle? securityStyle, bool? isSmbEncryptionEnabled, SmbAccessBasedEnumeration? smbAccessBasedEnumeration, SmbNonBrowsable? smbNonBrowsable, bool? isSmbContinuouslyAvailable, float? throughputMibps, float? actualThroughputMibps, NetAppEncryptionKeySource? encryptionKeySource, ResourceIdentifier keyVaultPrivateEndpointResourceId, bool? isLdapEnabled, LdapServerType? ldapServerType, bool? isCoolAccessEnabled, int? coolnessPeriod, CoolAccessRetrievalPolicy? coolAccessRetrievalPolicy, CoolAccessTieringPolicy? coolAccessTieringPolicy, string unixPermissions, int? cloneProgress, NetAppFileAccessLog? fileAccessLogs, NetAppAvsDataStore? avsDataStore, IReadOnlyList dataStoreResourceId, bool? isDefaultQuotaEnabled, long? defaultUserQuotaInKiBs, long? defaultGroupQuotaInKiBs, long? maximumNumberOfFiles, string volumeGroupName, ResourceIdentifier capacityPoolResourceId, ResourceIdentifier proximityPlacementGroupId, string t2Network, string volumeSpecName, bool? isEncrypted, IList placementRules, EnableNetAppSubvolume? enableSubvolumes, string provisionedAvailabilityZone, bool? isLargeVolume, ResourceIdentifier originatingResourceId, long? inheritedSizeInBytes, NetAppVolumeLanguage? language, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) - { - ETag = etag; - Zones = zones; - FileSystemId = fileSystemId; - CreationToken = creationToken; - ServiceLevel = serviceLevel; - UsageThreshold = usageThreshold; - ExportPolicy = exportPolicy; - ProtocolTypes = protocolTypes; - ProvisioningState = provisioningState; - SnapshotId = snapshotId; - DeleteBaseSnapshot = deleteBaseSnapshot; - BackupId = backupId; - BaremetalTenantId = baremetalTenantId; - SubnetId = subnetId; - NetworkFeatures = networkFeatures; - EffectiveNetworkFeatures = effectiveNetworkFeatures; - NetworkSiblingSetId = networkSiblingSetId; - StorageToNetworkProximity = storageToNetworkProximity; - MountTargets = mountTargets; - VolumeType = volumeType; - DataProtection = dataProtection; - AcceptGrowCapacityPoolForShortTermCloneSplit = acceptGrowCapacityPoolForShortTermCloneSplit; - IsRestoring = isRestoring; - IsSnapshotDirectoryVisible = isSnapshotDirectoryVisible; - IsKerberosEnabled = isKerberosEnabled; - SecurityStyle = securityStyle; - IsSmbEncryptionEnabled = isSmbEncryptionEnabled; - SmbAccessBasedEnumeration = smbAccessBasedEnumeration; - SmbNonBrowsable = smbNonBrowsable; - IsSmbContinuouslyAvailable = isSmbContinuouslyAvailable; - ThroughputMibps = throughputMibps; - ActualThroughputMibps = actualThroughputMibps; - EncryptionKeySource = encryptionKeySource; - KeyVaultPrivateEndpointResourceId = keyVaultPrivateEndpointResourceId; - IsLdapEnabled = isLdapEnabled; - LdapServerType = ldapServerType; - IsCoolAccessEnabled = isCoolAccessEnabled; - CoolnessPeriod = coolnessPeriod; - CoolAccessRetrievalPolicy = coolAccessRetrievalPolicy; - CoolAccessTieringPolicy = coolAccessTieringPolicy; - UnixPermissions = unixPermissions; - CloneProgress = cloneProgress; - FileAccessLogs = fileAccessLogs; - AvsDataStore = avsDataStore; - DataStoreResourceId = dataStoreResourceId; - IsDefaultQuotaEnabled = isDefaultQuotaEnabled; - DefaultUserQuotaInKiBs = defaultUserQuotaInKiBs; - DefaultGroupQuotaInKiBs = defaultGroupQuotaInKiBs; - MaximumNumberOfFiles = maximumNumberOfFiles; - VolumeGroupName = volumeGroupName; - CapacityPoolResourceId = capacityPoolResourceId; - ProximityPlacementGroupId = proximityPlacementGroupId; - T2Network = t2Network; - VolumeSpecName = volumeSpecName; - IsEncrypted = isEncrypted; - PlacementRules = placementRules; - EnableSubvolumes = enableSubvolumes; - ProvisionedAvailabilityZone = provisionedAvailabilityZone; - IsLargeVolume = isLargeVolume; - OriginatingResourceId = originatingResourceId; - InheritedSizeInBytes = inheritedSizeInBytes; - Language = language; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppVolumeData() - { - } - - /// A unique read-only string that changes whenever the resource is updated. - public ETag? ETag { get; } - /// Availability Zone. - public IList Zones { get; } - /// Unique FileSystem Identifier. - public Guid? FileSystemId { get; } - /// A unique file path for the volume. Used when creating mount targets. - public string CreationToken { get; set; } - /// The service level of the file system. - public NetAppFileServiceLevel? ServiceLevel { get; set; } - /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. Values expressed in bytes as multiples of 1 GiB. - public long UsageThreshold { get; set; } - /// Set of export policy rules. - internal VolumePropertiesExportPolicy ExportPolicy { get; set; } - /// Export policy rule. - public IList ExportRules - { - get - { - if (ExportPolicy is null) - ExportPolicy = new VolumePropertiesExportPolicy(); - return ExportPolicy.Rules; - } - } - - /// Set of protocol types, default NFSv3, CIFS for SMB protocol. - public IList ProtocolTypes { get; } - /// Azure lifecycle management. - public string ProvisioningState { get; } - /// Resource identifier used to identify the Snapshot. - public string SnapshotId { get; set; } - /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. - public bool? DeleteBaseSnapshot { get; set; } - /// Resource identifier used to identify the Backup. - public string BackupId { get; set; } - /// Unique Baremetal Tenant Identifier. - public string BaremetalTenantId { get; } - /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - public ResourceIdentifier SubnetId { get; set; } - /// The original value of the network features type available to the volume at the time it was created. - public NetAppNetworkFeature? NetworkFeatures { get; set; } - /// The effective value of the network features type available to the volume, or current effective state of update. - public NetAppNetworkFeature? EffectiveNetworkFeatures { get; } - /// Network Sibling Set ID for the the group of volumes sharing networking resources. - public Guid? NetworkSiblingSetId { get; } - /// Provides storage to network proximity information for the volume. - public NetAppVolumeStorageToNetworkProximity? StorageToNetworkProximity { get; } - /// List of mount targets. - public IReadOnlyList MountTargets { get; } - /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. For creating clone volume, set type to ShortTermClone. - public string VolumeType { get; set; } - /// DataProtection type volumes include an object containing details of the replication. - public NetAppVolumeDataProtection DataProtection { get; set; } - /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. - public AcceptGrowCapacityPoolForShortTermCloneSplit? AcceptGrowCapacityPoolForShortTermCloneSplit { get; set; } - /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). - public bool? IsSnapshotDirectoryVisible { get; set; } - /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. - public bool? IsKerberosEnabled { get; set; } - /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. - public NetAppVolumeSecurityStyle? SecurityStyle { get; set; } - /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - public bool? IsSmbEncryptionEnabled { get; set; } - /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. - public SmbAccessBasedEnumeration? SmbAccessBasedEnumeration { get; set; } - /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. - public SmbNonBrowsable? SmbNonBrowsable { get; set; } - /// Enables continuously available share property for smb volume. Only applicable for SMB volume. - public bool? IsSmbContinuouslyAvailable { get; set; } - /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. - public float? ThroughputMibps { get; set; } - /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. - public float? ActualThroughputMibps { get; } - /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. - public NetAppEncryptionKeySource? EncryptionKeySource { get; set; } - /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. - public ResourceIdentifier KeyVaultPrivateEndpointResourceId { get; set; } - /// Specifies whether LDAP is enabled or not for a given NFS volume. - public bool? IsLdapEnabled { get; set; } - /// Specifies the type of LDAP server for a given NFS volume. - public LdapServerType? LdapServerType { get; set; } - /// Specifies whether Cool Access(tiering) is enabled for the volume. - public bool? IsCoolAccessEnabled { get; set; } - /// Specifies the number of days after which data that is not accessed by clients will be tiered. - public int? CoolnessPeriod { get; set; } - /// - /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: - /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. - /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. - /// Never - No client-driven data is pulled from cool tier to standard storage. - /// - public CoolAccessRetrievalPolicy? CoolAccessRetrievalPolicy { get; set; } - /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. - public CoolAccessTieringPolicy? CoolAccessTieringPolicy { get; set; } - /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. Avoid passing null value for unixPermissions in volume update operation, As per the behavior, If Null value is passed then user-visible unixPermissions value will became null, and user will not be able to get unixPermissions value. On safer side, actual unixPermissions value on volume will remain as its last saved value only. - public string UnixPermissions { get; set; } - /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - public int? CloneProgress { get; } - /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. - public NetAppFileAccessLog? FileAccessLogs { get; } - /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. - public NetAppAvsDataStore? AvsDataStore { get; set; } - /// Data store resource unique identifier. - public IReadOnlyList DataStoreResourceId { get; } - /// Specifies if default quota is enabled for the volume. - public bool? IsDefaultQuotaEnabled { get; set; } - /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - public long? DefaultUserQuotaInKiBs { get; set; } - /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - public long? DefaultGroupQuotaInKiBs { get; set; } - /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - public long? MaximumNumberOfFiles { get; } - /// Volume Group Name. - public string VolumeGroupName { get; } - /// Pool Resource Id used in case of creating a volume through volume group. - public ResourceIdentifier CapacityPoolResourceId { get; set; } - /// Proximity placement group associated with the volume. - public ResourceIdentifier ProximityPlacementGroupId { get; set; } - /// T2 network information. - public string T2Network { get; } - /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. - public string VolumeSpecName { get; set; } - /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. - public bool? IsEncrypted { get; } - /// Application specific placement rules for the particular volume. - public IList PlacementRules { get; } - /// Flag indicating whether subvolume operations are enabled on the volume. - public EnableNetAppSubvolume? EnableSubvolumes { get; set; } - /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. - public string ProvisionedAvailabilityZone { get; } - /// Specifies whether volume is a Large Volume or Regular Volume. - public bool? IsLargeVolume { get; set; } - /// Id of the snapshot or backup that the volume is restored from. - public ResourceIdentifier OriginatingResourceId { get; } - /// Space shared by short term clone volume with parent volume in bytes. - public long? InheritedSizeInBytes { get; } - /// Language supported for volume. - public NetAppVolumeLanguage? Language { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupCollection.cs deleted file mode 100644 index f12ec95bb93b..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupCollection.cs +++ /dev/null @@ -1,415 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNetAppVolumeGroups method from an instance of . - /// - public partial class NetAppVolumeGroupCollection : ArmCollection - { - private readonly ClientDiagnostics _netAppVolumeGroupVolumeGroupsClientDiagnostics; - private readonly VolumeGroupsRestOperations _netAppVolumeGroupVolumeGroupsRestClient; - - /// Initializes a new instance of the class for mocking. - protected NetAppVolumeGroupCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal NetAppVolumeGroupCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppVolumeGroupVolumeGroupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppVolumeGroupResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppVolumeGroupResource.ResourceType, out string netAppVolumeGroupVolumeGroupsApiVersion); - _netAppVolumeGroupVolumeGroupsRestClient = new VolumeGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppVolumeGroupVolumeGroupsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != NetAppAccountResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetAppAccountResource.ResourceType), nameof(id)); - } - - /// - /// Create a volume group along with specified volumes - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the volumeGroup. - /// Volume Group object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string volumeGroupName, NetAppVolumeGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _netAppVolumeGroupVolumeGroupsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeGroupOperationSource(Client), _netAppVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _netAppVolumeGroupVolumeGroupsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a volume group along with specified volumes - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the volumeGroup. - /// Volume Group object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string volumeGroupName, NetAppVolumeGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _netAppVolumeGroupVolumeGroupsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeGroupOperationSource(Client), _netAppVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _netAppVolumeGroupVolumeGroupsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified volume group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volumeGroup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string volumeGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupCollection.Get"); - scope.Start(); - try - { - var response = await _netAppVolumeGroupVolumeGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified volume group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volumeGroup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string volumeGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupCollection.Get"); - scope.Start(); - try - { - var response = _netAppVolumeGroupVolumeGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volumeGroup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string volumeGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupCollection.Exists"); - scope.Start(); - try - { - var response = await _netAppVolumeGroupVolumeGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volumeGroup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string volumeGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupCollection.Exists"); - scope.Start(); - try - { - var response = _netAppVolumeGroupVolumeGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volumeGroup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string volumeGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _netAppVolumeGroupVolumeGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the volumeGroup. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string volumeGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupCollection.GetIfExists"); - scope.Start(); - try - { - var response = _netAppVolumeGroupVolumeGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, volumeGroupName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupData.Serialization.cs deleted file mode 100644 index e233275d0ed6..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupData.Serialization.cs +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppVolumeGroupData : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeGroupData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Location)) - { - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location.Value); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsDefined(GroupMetaData)) - { - writer.WritePropertyName("groupMetaData"u8); - writer.WriteObjectValue(GroupMetaData, options); - } - if (Optional.IsCollectionDefined(Volumes)) - { - writer.WritePropertyName("volumes"u8); - writer.WriteStartArray(); - foreach (var item in Volumes) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - - NetAppVolumeGroupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeGroupData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeGroupData(document.RootElement, options); - } - - internal static NetAppVolumeGroupData DeserializeNetAppVolumeGroupData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AzureLocation? location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string provisioningState = default; - NetAppVolumeGroupMetadata groupMetaData = default; - IList volumes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("location"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("groupMetaData"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - groupMetaData = NetAppVolumeGroupMetadata.DeserializeNetAppVolumeGroupMetadata(property0.Value, options); - continue; - } - if (property0.NameEquals("volumes"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(NetAppVolumeGroupVolume.DeserializeNetAppVolumeGroupVolume(item, options)); - } - volumes = array; - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeGroupData( - id, - name, - type, - systemData, - location, - provisioningState, - groupMetaData, - volumes ?? new ChangeTrackingList(), - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeGroupData)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeGroupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeGroupData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeGroupData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupData.cs deleted file mode 100644 index 09fabf3c71d1..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupData.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing the NetAppVolumeGroup data model. - /// Volume group resource for create - /// - public partial class NetAppVolumeGroupData : ResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public NetAppVolumeGroupData() - { - Volumes = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Resource location. - /// Azure lifecycle management. - /// Volume group details. - /// List of volumes from group. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, string provisioningState, NetAppVolumeGroupMetadata groupMetaData, IList volumes, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Location = location; - ProvisioningState = provisioningState; - GroupMetaData = groupMetaData; - Volumes = volumes; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Resource location. - public AzureLocation? Location { get; set; } - /// Azure lifecycle management. - public string ProvisioningState { get; } - /// Volume group details. - public NetAppVolumeGroupMetadata GroupMetaData { get; set; } - /// List of volumes from group. - public IList Volumes { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.Serialization.cs deleted file mode 100644 index fb17dd7cb5bb..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppVolumeGroupResource : IJsonModel - { - private static NetAppVolumeGroupData s_dataDeserializationInstance; - private static NetAppVolumeGroupData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - NetAppVolumeGroupData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); - - NetAppVolumeGroupData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.cs deleted file mode 100644 index 294a05d17017..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeGroupResource.cs +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A Class representing a NetAppVolumeGroup along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNetAppVolumeGroupResource method. - /// Otherwise you can get one from its parent resource using the GetNetAppVolumeGroup method. - /// - public partial class NetAppVolumeGroupResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The volumeGroupName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _netAppVolumeGroupVolumeGroupsClientDiagnostics; - private readonly VolumeGroupsRestOperations _netAppVolumeGroupVolumeGroupsRestClient; - private readonly NetAppVolumeGroupData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/volumeGroups"; - - /// Initializes a new instance of the class for mocking. - protected NetAppVolumeGroupResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NetAppVolumeGroupResource(ArmClient client, NetAppVolumeGroupData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NetAppVolumeGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppVolumeGroupVolumeGroupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string netAppVolumeGroupVolumeGroupsApiVersion); - _netAppVolumeGroupVolumeGroupsRestClient = new VolumeGroupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppVolumeGroupVolumeGroupsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NetAppVolumeGroupData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get details of the specified volume group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupResource.Get"); - scope.Start(); - try - { - var response = await _netAppVolumeGroupVolumeGroupsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified volume group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupResource.Get"); - scope.Start(); - try - { - var response = _netAppVolumeGroupVolumeGroupsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeGroupResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete the specified volume group only if there are no volumes under volume group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupResource.Delete"); - scope.Start(); - try - { - var response = await _netAppVolumeGroupVolumeGroupsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _netAppVolumeGroupVolumeGroupsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete the specified volume group only if there are no volumes under volume group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupResource.Delete"); - scope.Start(); - try - { - var response = _netAppVolumeGroupVolumeGroupsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _netAppVolumeGroupVolumeGroupsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a volume group along with specified volumes - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Volume Group object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, NetAppVolumeGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupResource.Update"); - scope.Start(); - try - { - var response = await _netAppVolumeGroupVolumeGroupsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeGroupOperationSource(Client), _netAppVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _netAppVolumeGroupVolumeGroupsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create a volume group along with specified volumes - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName} - /// - /// - /// Operation Id - /// VolumeGroups_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Volume Group object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, NetAppVolumeGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeGroupVolumeGroupsClientDiagnostics.CreateScope("NetAppVolumeGroupResource.Update"); - scope.Start(); - try - { - var response = _netAppVolumeGroupVolumeGroupsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeGroupOperationSource(Client), _netAppVolumeGroupVolumeGroupsClientDiagnostics, Pipeline, _netAppVolumeGroupVolumeGroupsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleCollection.cs deleted file mode 100644 index cb61ac7c5bec..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleCollection.cs +++ /dev/null @@ -1,491 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNetAppVolumeQuotaRules method from an instance of . - /// - public partial class NetAppVolumeQuotaRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics; - private readonly VolumeQuotaRulesRestOperations _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient; - - /// Initializes a new instance of the class for mocking. - protected NetAppVolumeQuotaRuleCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal NetAppVolumeQuotaRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppVolumeQuotaRuleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppVolumeQuotaRuleResource.ResourceType, out string netAppVolumeQuotaRuleVolumeQuotaRulesApiVersion); - _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient = new VolumeQuotaRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppVolumeQuotaRuleVolumeQuotaRulesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != NetAppVolumeResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetAppVolumeResource.ResourceType), nameof(id)); - } - - /// - /// Create the specified quota rule within the given volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of volume quota rule. - /// Quota rule object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string volumeQuotaRuleName, NetAppVolumeQuotaRuleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeQuotaRuleOperationSource(Client), _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics, Pipeline, _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create the specified quota rule within the given volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of volume quota rule. - /// Quota rule object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string volumeQuotaRuleName, NetAppVolumeQuotaRuleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeQuotaRuleOperationSource(Client), _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics, Pipeline, _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified quota rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of volume quota rule. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleCollection.Get"); - scope.Start(); - try - { - var response = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified quota rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of volume quota rule. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleCollection.Get"); - scope.Start(); - try - { - var response = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all quota rules associated with the volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules - /// - /// - /// Operation Id - /// VolumeQuotaRules_ListByVolume - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.CreateListByVolumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new NetAppVolumeQuotaRuleResource(Client, NetAppVolumeQuotaRuleData.DeserializeNetAppVolumeQuotaRuleData(e)), _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics, Pipeline, "NetAppVolumeQuotaRuleCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// List all quota rules associated with the volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules - /// - /// - /// Operation Id - /// VolumeQuotaRules_ListByVolume - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.CreateListByVolumeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new NetAppVolumeQuotaRuleResource(Client, NetAppVolumeQuotaRuleData.DeserializeNetAppVolumeQuotaRuleData(e)), _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics, Pipeline, "NetAppVolumeQuotaRuleCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of volume quota rule. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleCollection.Exists"); - scope.Start(); - try - { - var response = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of volume quota rule. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleCollection.Exists"); - scope.Start(); - try - { - var response = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of volume quota rule. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of volume quota rule. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleCollection.GetIfExists"); - scope.Start(); - try - { - var response = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleData.Serialization.cs deleted file mode 100644 index 4bf2e6ab2776..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleData.Serialization.cs +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppVolumeQuotaRuleData : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeQuotaRuleData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToSerialString()); - } - if (Optional.IsDefined(QuotaSizeInKiBs)) - { - writer.WritePropertyName("quotaSizeInKiBs"u8); - writer.WriteNumberValue(QuotaSizeInKiBs.Value); - } - if (Optional.IsDefined(QuotaType)) - { - writer.WritePropertyName("quotaType"u8); - writer.WriteStringValue(QuotaType.Value.ToString()); - } - if (Optional.IsDefined(QuotaTarget)) - { - writer.WritePropertyName("quotaTarget"u8); - writer.WriteStringValue(QuotaTarget); - } - writer.WriteEndObject(); - } - - NetAppVolumeQuotaRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeQuotaRuleData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeQuotaRuleData(document.RootElement, options); - } - - internal static NetAppVolumeQuotaRuleData DeserializeNetAppVolumeQuotaRuleData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - NetAppProvisioningState? provisioningState = default; - long? quotaSizeInKiBs = default; - NetAppVolumeQuotaType? quotaType = default; - string quotaTarget = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = property0.Value.GetString().ToNetAppProvisioningState(); - continue; - } - if (property0.NameEquals("quotaSizeInKiBs"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - quotaSizeInKiBs = property0.Value.GetInt64(); - continue; - } - if (property0.NameEquals("quotaType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - quotaType = new NetAppVolumeQuotaType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("quotaTarget"u8)) - { - quotaTarget = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeQuotaRuleData( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - provisioningState, - quotaSizeInKiBs, - quotaType, - quotaTarget, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeQuotaRuleData)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeQuotaRuleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeQuotaRuleData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeQuotaRuleData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleData.cs deleted file mode 100644 index 3607b08f6245..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleData.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing the NetAppVolumeQuotaRule data model. - /// Quota Rule of a Volume - /// - public partial class NetAppVolumeQuotaRuleData : TrackedResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The location. - public NetAppVolumeQuotaRuleData(AzureLocation location) : base(location) - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Provisioning state of the resource. - /// Size of quota. - /// Type of quota. - /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeQuotaRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NetAppProvisioningState? provisioningState, long? quotaSizeInKiBs, NetAppVolumeQuotaType? quotaType, string quotaTarget, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) - { - ProvisioningState = provisioningState; - QuotaSizeInKiBs = quotaSizeInKiBs; - QuotaType = quotaType; - QuotaTarget = quotaTarget; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppVolumeQuotaRuleData() - { - } - - /// Provisioning state of the resource. - public NetAppProvisioningState? ProvisioningState { get; } - /// Size of quota. - public long? QuotaSizeInKiBs { get; set; } - /// Type of quota. - public NetAppVolumeQuotaType? QuotaType { get; set; } - /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. - public string QuotaTarget { get; set; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.Serialization.cs deleted file mode 100644 index 38244a3691f0..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppVolumeQuotaRuleResource : IJsonModel - { - private static NetAppVolumeQuotaRuleData s_dataDeserializationInstance; - private static NetAppVolumeQuotaRuleData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - NetAppVolumeQuotaRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); - - NetAppVolumeQuotaRuleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.cs deleted file mode 100644 index 5af96ea1c779..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeQuotaRuleResource.cs +++ /dev/null @@ -1,709 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A Class representing a NetAppVolumeQuotaRule along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNetAppVolumeQuotaRuleResource method. - /// Otherwise you can get one from its parent resource using the GetNetAppVolumeQuotaRule method. - /// - public partial class NetAppVolumeQuotaRuleResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The poolName. - /// The volumeName. - /// The volumeQuotaRuleName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics; - private readonly VolumeQuotaRulesRestOperations _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient; - private readonly NetAppVolumeQuotaRuleData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/volumeQuotaRules"; - - /// Initializes a new instance of the class for mocking. - protected NetAppVolumeQuotaRuleResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NetAppVolumeQuotaRuleResource(ArmClient client, NetAppVolumeQuotaRuleData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NetAppVolumeQuotaRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string netAppVolumeQuotaRuleVolumeQuotaRulesApiVersion); - _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient = new VolumeQuotaRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppVolumeQuotaRuleVolumeQuotaRulesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NetAppVolumeQuotaRuleData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get details of the specified quota rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.Get"); - scope.Start(); - try - { - var response = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified quota rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.Get"); - scope.Start(); - try - { - var response = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete quota rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.Delete"); - scope.Start(); - try - { - var response = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics, Pipeline, _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete quota rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.Delete"); - scope.Start(); - try - { - var response = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics, Pipeline, _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch a quota rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Quota rule object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, NetAppVolumeQuotaRulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.Update"); - scope.Start(); - try - { - var response = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeQuotaRuleOperationSource(Client), _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics, Pipeline, _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch a quota rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Quota rule object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, NetAppVolumeQuotaRulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.Update"); - scope.Start(); - try - { - var response = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeQuotaRuleOperationSource(Client), _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics, Pipeline, _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. - /// The cancellation token to use. - /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.AddTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues[key] = value; - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppVolumeQuotaRulePatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. - /// The cancellation token to use. - /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.AddTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppVolumeQuotaRulePatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. - /// The cancellation token to use. - /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tags, nameof(tags)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.SetTags"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppVolumeQuotaRulePatch(); - patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. - /// The cancellation token to use. - /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tags, nameof(tags)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.SetTags"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppVolumeQuotaRulePatch(); - patch.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The cancellation token to use. - /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.RemoveTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.Remove(key); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppVolumeQuotaRulePatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The cancellation token to use. - /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - - using var scope = _netAppVolumeQuotaRuleVolumeQuotaRulesClientDiagnostics.CreateScope("NetAppVolumeQuotaRuleResource.RemoveTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppVolumeQuotaRuleVolumeQuotaRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppVolumeQuotaRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppVolumeQuotaRulePatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.Serialization.cs deleted file mode 100644 index 8a381b044996..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppVolumeResource : IJsonModel - { - private static NetAppVolumeData s_dataDeserializationInstance; - private static NetAppVolumeData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - NetAppVolumeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); - - NetAppVolumeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs deleted file mode 100644 index d4bdfa398c0e..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs +++ /dev/null @@ -1,3184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A Class representing a NetAppVolume along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNetAppVolumeResource method. - /// Otherwise you can get one from its parent resource using the GetNetAppVolume method. - /// - public partial class NetAppVolumeResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The poolName. - /// The volumeName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _netAppVolumeVolumesClientDiagnostics; - private readonly VolumesRestOperations _netAppVolumeVolumesRestClient; - private readonly ClientDiagnostics _netAppBackupVaultBackupBackupsClientDiagnostics; - private readonly BackupsRestOperations _netAppBackupVaultBackupBackupsRestClient; - private readonly ClientDiagnostics _backupsUnderVolumeClientDiagnostics; - private readonly BackupsUnderVolumeRestOperations _backupsUnderVolumeRestClient; - private readonly NetAppVolumeData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes"; - - /// Initializes a new instance of the class for mocking. - protected NetAppVolumeResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NetAppVolumeResource(ArmClient client, NetAppVolumeData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NetAppVolumeResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppVolumeVolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string netAppVolumeVolumesApiVersion); - _netAppVolumeVolumesRestClient = new VolumesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppVolumeVolumesApiVersion); - _netAppBackupVaultBackupBackupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppBackupVaultBackupResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppBackupVaultBackupResource.ResourceType, out string netAppBackupVaultBackupBackupsApiVersion); - _netAppBackupVaultBackupBackupsRestClient = new BackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppBackupVaultBackupBackupsApiVersion); - _backupsUnderVolumeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _backupsUnderVolumeRestClient = new BackupsUnderVolumeRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NetAppVolumeData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// Gets a collection of NetAppVolumeSnapshotResources in the NetAppVolume. - /// An object representing collection of NetAppVolumeSnapshotResources and their operations over a NetAppVolumeSnapshotResource. - public virtual NetAppVolumeSnapshotCollection GetNetAppVolumeSnapshots() - { - return GetCachedClient(client => new NetAppVolumeSnapshotCollection(client, Id)); - } - - /// - /// Get details of the specified snapshot - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the snapshot. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetNetAppVolumeSnapshotAsync(string snapshotName, CancellationToken cancellationToken = default) - { - return await GetNetAppVolumeSnapshots().GetAsync(snapshotName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get details of the specified snapshot - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the snapshot. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetNetAppVolumeSnapshot(string snapshotName, CancellationToken cancellationToken = default) - { - return GetNetAppVolumeSnapshots().Get(snapshotName, cancellationToken); - } - - /// Gets a collection of NetAppVolumeQuotaRuleResources in the NetAppVolume. - /// An object representing collection of NetAppVolumeQuotaRuleResources and their operations over a NetAppVolumeQuotaRuleResource. - public virtual NetAppVolumeQuotaRuleCollection GetNetAppVolumeQuotaRules() - { - return GetCachedClient(client => new NetAppVolumeQuotaRuleCollection(client, Id)); - } - - /// - /// Get details of the specified quota rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of volume quota rule. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetNetAppVolumeQuotaRuleAsync(string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - return await GetNetAppVolumeQuotaRules().GetAsync(volumeQuotaRuleName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get details of the specified quota rule - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName} - /// - /// - /// Operation Id - /// VolumeQuotaRules_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of volume quota rule. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetNetAppVolumeQuotaRule(string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - return GetNetAppVolumeQuotaRules().Get(volumeQuotaRuleName, cancellationToken); - } - - /// Gets a collection of NetAppSubvolumeInfoResources in the NetAppVolume. - /// An object representing collection of NetAppSubvolumeInfoResources and their operations over a NetAppSubvolumeInfoResource. - public virtual NetAppSubvolumeInfoCollection GetNetAppSubvolumeInfos() - { - return GetCachedClient(client => new NetAppSubvolumeInfoCollection(client, Id)); - } - - /// - /// Returns the path associated with the subvolumeName provided - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the subvolume. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetNetAppSubvolumeInfoAsync(string subvolumeName, CancellationToken cancellationToken = default) - { - return await GetNetAppSubvolumeInfos().GetAsync(subvolumeName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Returns the path associated with the subvolumeName provided - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName} - /// - /// - /// Operation Id - /// Subvolumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the subvolume. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetNetAppSubvolumeInfo(string subvolumeName, CancellationToken cancellationToken = default) - { - return GetNetAppSubvolumeInfos().Get(subvolumeName, cancellationToken); - } - - /// Gets a collection of NetAppBucketResources in the NetAppVolume. - /// An object representing collection of NetAppBucketResources and their operations over a NetAppBucketResource. - public virtual NetAppBucketCollection GetNetAppBuckets() - { - return GetCachedClient(client => new NetAppBucketCollection(client, Id)); - } - - /// - /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the bucket. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetNetAppBucketAsync(string bucketName, CancellationToken cancellationToken = default) - { - return await GetNetAppBuckets().GetAsync(bucketName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/buckets/{bucketName} - /// - /// - /// Operation Id - /// Buckets_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the bucket. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetNetAppBucket(string bucketName, CancellationToken cancellationToken = default) - { - return GetNetAppBuckets().Get(bucketName, cancellationToken); - } - - /// - /// Get the details of the specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.Get"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the details of the specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.Get"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete the specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// An option to force delete the volume. Will cleanup resources connected to the particular volume. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? forceDelete = null, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.Delete"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, forceDelete, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, forceDelete).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete the specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// An option to force delete the volume. Will cleanup resources connected to the particular volume. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, bool? forceDelete = null, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.Delete"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, forceDelete, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, forceDelete).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch the specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Volume object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, NetAppVolumePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.Update"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeOperationSource(Client), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Patch the specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Update - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Volume object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, NetAppVolumePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.Update"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeOperationSource(Client), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This operation will populate availability zone information for a volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/populateAvailabilityZone - /// - /// - /// Operation Id - /// Volumes_PopulateAvailabilityZone - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task> PopulateAvailabilityZoneAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.PopulateAvailabilityZone"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.PopulateAvailabilityZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeOperationSource(Client), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreatePopulateAvailabilityZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This operation will populate availability zone information for a volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/populateAvailabilityZone - /// - /// - /// Operation Id - /// Volumes_PopulateAvailabilityZone - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation PopulateAvailabilityZone(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.PopulateAvailabilityZone"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.PopulateAvailabilityZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeOperationSource(Client), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreatePopulateAvailabilityZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Revert a volume to the snapshot specified in the body - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert - /// - /// - /// Operation Id - /// Volumes_Revert - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Object for snapshot to revert supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task RevertAsync(WaitUntil waitUntil, NetAppVolumeRevertContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.Revert"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.RevertAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateRevertRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Revert a volume to the snapshot specified in the body - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert - /// - /// - /// Operation Id - /// Volumes_Revert - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Object for snapshot to revert supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Revert(WaitUntil waitUntil, NetAppVolumeRevertContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.Revert"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.Revert(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateRevertRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Reset cifs password from volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword - /// - /// - /// Operation Id - /// Volumes_ResetCifsPassword - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task ResetCifsPasswordAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.ResetCifsPassword"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.ResetCifsPasswordAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateResetCifsPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Reset cifs password from volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword - /// - /// - /// Operation Id - /// Volumes_ResetCifsPassword - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation ResetCifsPassword(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.ResetCifsPassword"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.ResetCifsPassword(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateResetCifsPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Split operation to convert clone volume to an independent volume. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/splitCloneFromParent - /// - /// - /// Operation Id - /// Volumes_SplitCloneFromParent - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task> SplitCloneFromParentAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.SplitCloneFromParent"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.SplitCloneFromParentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeOperationSource(Client), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateSplitCloneFromParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Split operation to convert clone volume to an independent volume. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/splitCloneFromParent - /// - /// - /// Operation Id - /// Volumes_SplitCloneFromParent - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation SplitCloneFromParent(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.SplitCloneFromParent"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.SplitCloneFromParent(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeOperationSource(Client), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateSplitCloneFromParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Break all the file locks on a volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakFileLocks - /// - /// - /// Operation Id - /// Volumes_BreakFileLocks - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Optional body to provide the ability to clear file locks with selected options. - /// The cancellation token to use. - public virtual async Task BreakFileLocksAsync(WaitUntil waitUntil, NetAppVolumeBreakFileLocksContent content = null, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.BreakFileLocks"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.BreakFileLocksAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateBreakFileLocksRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Break all the file locks on a volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakFileLocks - /// - /// - /// Operation Id - /// Volumes_BreakFileLocks - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Optional body to provide the ability to clear file locks with selected options. - /// The cancellation token to use. - public virtual ArmOperation BreakFileLocks(WaitUntil waitUntil, NetAppVolumeBreakFileLocksContent content = null, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.BreakFileLocks"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.BreakFileLocks(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateBreakFileLocksRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns the list of group Ids for a specific LDAP User - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/getGroupIdListForLdapUser - /// - /// - /// Operation Id - /// Volumes_ListGetGroupIdListForLdapUser - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Returns group Id list for a specific LDAP user. - /// The cancellation token to use. - /// is null. - public virtual async Task> GetGetGroupIdListForLdapUserAsync(WaitUntil waitUntil, GetGroupIdListForLdapUserContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.GetGetGroupIdListForLdapUser"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.ListGetGroupIdListForLdapUserAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new GetGroupIdListForLdapUserResultOperationSource(), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateListGetGroupIdListForLdapUserRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns the list of group Ids for a specific LDAP User - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/getGroupIdListForLdapUser - /// - /// - /// Operation Id - /// Volumes_ListGetGroupIdListForLdapUser - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Returns group Id list for a specific LDAP user. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation GetGetGroupIdListForLdapUser(WaitUntil waitUntil, GetGroupIdListForLdapUserContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.GetGetGroupIdListForLdapUser"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.ListGetGroupIdListForLdapUser(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(new GetGroupIdListForLdapUserResultOperationSource(), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateListGetGroupIdListForLdapUserRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns report of quotas for the volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listQuotaReport - /// - /// - /// Operation Id - /// Volumes_ListQuotaReport - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task> GetQuotaReportAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.GetQuotaReport"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.ListQuotaReportAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeQuotaReportListResultOperationSource(), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateListQuotaReportRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns report of quotas for the volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listQuotaReport - /// - /// - /// Operation Id - /// Volumes_ListQuotaReport - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation GetQuotaReport(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.GetQuotaReport"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.ListQuotaReport(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeQuotaReportListResultOperationSource(), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateListQuotaReportRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Break the replication connection on the destination volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication - /// - /// - /// Operation Id - /// Volumes_BreakReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Optional body to force break the replication. - /// The cancellation token to use. - public virtual async Task BreakReplicationAsync(WaitUntil waitUntil, NetAppVolumeBreakReplicationContent content = null, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.BreakReplication"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.BreakReplicationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateBreakReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Break the replication connection on the destination volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication - /// - /// - /// Operation Id - /// Volumes_BreakReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Optional body to force break the replication. - /// The cancellation token to use. - public virtual ArmOperation BreakReplication(WaitUntil waitUntil, NetAppVolumeBreakReplicationContent content = null, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.BreakReplication"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.BreakReplication(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateBreakReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Re-establish a previously deleted replication between 2 volumes that have a common ad-hoc or policy-based snapshots - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication - /// - /// - /// Operation Id - /// Volumes_ReestablishReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// body for the id of the source volume. - /// The cancellation token to use. - /// is null. - public virtual async Task ReestablishReplicationAsync(WaitUntil waitUntil, NetAppVolumeReestablishReplicationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.ReestablishReplication"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.ReestablishReplicationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateReestablishReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Re-establish a previously deleted replication between 2 volumes that have a common ad-hoc or policy-based snapshots - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication - /// - /// - /// Operation Id - /// Volumes_ReestablishReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// body for the id of the source volume. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation ReestablishReplication(WaitUntil waitUntil, NetAppVolumeReestablishReplicationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.ReestablishReplication"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.ReestablishReplication(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateReestablishReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the status of the replication - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus - /// - /// - /// Operation Id - /// Volumes_ReplicationStatus - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetReplicationStatusAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.GetReplicationStatus"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.ReplicationStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the status of the replication - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus - /// - /// - /// Operation Id - /// Volumes_ReplicationStatus - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetReplicationStatus(CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.GetReplicationStatus"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.ReplicationStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all replications for a specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listReplications - /// - /// - /// Operation Id - /// Volumes_ListReplications - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetReplicationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppVolumeVolumesRestClient.CreateListReplicationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => NetAppVolumeReplication.DeserializeNetAppVolumeReplication(e), _netAppVolumeVolumesClientDiagnostics, Pipeline, "NetAppVolumeResource.GetReplications", "value", null, cancellationToken); - } - - /// - /// List all replications for a specified volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listReplications - /// - /// - /// Operation Id - /// Volumes_ListReplications - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetReplications(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppVolumeVolumesRestClient.CreateListReplicationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => NetAppVolumeReplication.DeserializeNetAppVolumeReplication(e), _netAppVolumeVolumesClientDiagnostics, Pipeline, "NetAppVolumeResource.GetReplications", "value", null, cancellationToken); - } - - /// - /// Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from destination to source. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication - /// - /// - /// Operation Id - /// Volumes_ResyncReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task ResyncReplicationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.ResyncReplication"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.ResyncReplicationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateResyncReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from destination to source. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication - /// - /// - /// Operation Id - /// Volumes_ResyncReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation ResyncReplication(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.ResyncReplication"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.ResyncReplication(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateResyncReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete the replication connection on the destination volume, and send release to the source replication - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication - /// - /// - /// Operation Id - /// Volumes_DeleteReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteReplicationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.DeleteReplication"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.DeleteReplicationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateDeleteReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete the replication connection on the destination volume, and send release to the source replication - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication - /// - /// - /// Operation Id - /// Volumes_DeleteReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation DeleteReplication(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.DeleteReplication"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.DeleteReplication(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateDeleteReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Authorize the replication connection on the source volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication - /// - /// - /// Operation Id - /// Volumes_AuthorizeReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Authorize request object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task AuthorizeReplicationAsync(WaitUntil waitUntil, NetAppVolumeAuthorizeReplicationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.AuthorizeReplication"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.AuthorizeReplicationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateAuthorizeReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Authorize the replication connection on the source volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication - /// - /// - /// Operation Id - /// Volumes_AuthorizeReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Authorize request object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation AuthorizeReplication(WaitUntil waitUntil, NetAppVolumeAuthorizeReplicationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.AuthorizeReplication"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.AuthorizeReplication(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateAuthorizeReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Re-Initializes the replication connection on the destination volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication - /// - /// - /// Operation Id - /// Volumes_ReInitializeReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task ReInitializeReplicationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.ReInitializeReplication"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.ReInitializeReplicationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateReInitializeReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Re-Initializes the replication connection on the destination volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication - /// - /// - /// Operation Id - /// Volumes_ReInitializeReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation ReInitializeReplication(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.ReInitializeReplication"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.ReInitializeReplication(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateReInitializeReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Starts peering the external cluster for this migration volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/peerExternalCluster - /// - /// - /// Operation Id - /// Volumes_PeerExternalCluster - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Cluster peer request object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> PeerExternalClusterAsync(WaitUntil waitUntil, PeerClusterForVolumeMigrationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.PeerExternalCluster"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.PeerExternalClusterAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new ClusterPeerCommandResultOperationSource(), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreatePeerExternalClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Starts peering the external cluster for this migration volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/peerExternalCluster - /// - /// - /// Operation Id - /// Volumes_PeerExternalCluster - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Cluster peer request object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation PeerExternalCluster(WaitUntil waitUntil, PeerClusterForVolumeMigrationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.PeerExternalCluster"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.PeerExternalCluster(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(new ClusterPeerCommandResultOperationSource(), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreatePeerExternalClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Starts SVM peering and returns a command to be run on the external ONTAP to accept it. Once the SVM have been peered a SnapMirror will be created - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeExternalReplication - /// - /// - /// Operation Id - /// Volumes_AuthorizeExternalReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task> AuthorizeExternalReplicationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.AuthorizeExternalReplication"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.AuthorizeExternalReplicationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new SvmPeerCommandResultOperationSource(), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateAuthorizeExternalReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Starts SVM peering and returns a command to be run on the external ONTAP to accept it. Once the SVM have been peered a SnapMirror will be created - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeExternalReplication - /// - /// - /// Operation Id - /// Volumes_AuthorizeExternalReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation AuthorizeExternalReplication(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.AuthorizeExternalReplication"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.AuthorizeExternalReplication(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(new SvmPeerCommandResultOperationSource(), _netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateAuthorizeExternalReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Finalizes the migration of an external volume by releasing the replication and breaking the external cluster peering if no other migration is active. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeExternalReplication - /// - /// - /// Operation Id - /// Volumes_FinalizeExternalReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task FinalizeExternalReplicationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.FinalizeExternalReplication"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.FinalizeExternalReplicationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateFinalizeExternalReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Finalizes the migration of an external volume by releasing the replication and breaking the external cluster peering if no other migration is active. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeExternalReplication - /// - /// - /// Operation Id - /// Volumes_FinalizeExternalReplication - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation FinalizeExternalReplication(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.FinalizeExternalReplication"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.FinalizeExternalReplication(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateFinalizeExternalReplicationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Performs an adhoc replication transfer on a volume with volumeType Migration - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/performReplicationTransfer - /// - /// - /// Operation Id - /// Volumes_PerformReplicationTransfer - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task PerformReplicationTransferAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.PerformReplicationTransfer"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.PerformReplicationTransferAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreatePerformReplicationTransferRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Performs an adhoc replication transfer on a volume with volumeType Migration - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/performReplicationTransfer - /// - /// - /// Operation Id - /// Volumes_PerformReplicationTransfer - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation PerformReplicationTransfer(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.PerformReplicationTransfer"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.PerformReplicationTransfer(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreatePerformReplicationTransferRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Moves volume to another pool - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange - /// - /// - /// Operation Id - /// Volumes_PoolChange - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Move volume to the pool supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task PoolChangeAsync(WaitUntil waitUntil, NetAppVolumePoolChangeContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.PoolChange"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.PoolChangeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreatePoolChangeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Moves volume to another pool - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange - /// - /// - /// Operation Id - /// Volumes_PoolChange - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Move volume to the pool supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation PoolChange(WaitUntil waitUntil, NetAppVolumePoolChangeContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.PoolChange"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.PoolChange(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreatePoolChangeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Relocates volume to a new stamp - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate - /// - /// - /// Operation Id - /// Volumes_Relocate - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Relocate volume request. - /// The cancellation token to use. - public virtual async Task RelocateAsync(WaitUntil waitUntil, RelocateVolumeContent content = null, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.Relocate"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.RelocateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateRelocateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Relocates volume to a new stamp - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate - /// - /// - /// Operation Id - /// Volumes_Relocate - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Relocate volume request. - /// The cancellation token to use. - public virtual ArmOperation Relocate(WaitUntil waitUntil, RelocateVolumeContent content = null, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.Relocate"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.Relocate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateRelocateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Finalizes the relocation of the volume and cleans up the old volume. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation - /// - /// - /// Operation Id - /// Volumes_FinalizeRelocation - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task FinalizeRelocationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.FinalizeRelocation"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.FinalizeRelocationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateFinalizeRelocationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Finalizes the relocation of the volume and cleans up the old volume. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation - /// - /// - /// Operation Id - /// Volumes_FinalizeRelocation - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation FinalizeRelocation(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.FinalizeRelocation"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.FinalizeRelocation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateFinalizeRelocationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Reverts the volume relocation process, cleans up the new volume and starts using the former-existing volume. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation - /// - /// - /// Operation Id - /// Volumes_RevertRelocation - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task RevertRelocationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.RevertRelocation"); - scope.Start(); - try - { - var response = await _netAppVolumeVolumesRestClient.RevertRelocationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateRevertRelocationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Reverts the volume relocation process, cleans up the new volume and starts using the former-existing volume. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation - /// - /// - /// Operation Id - /// Volumes_RevertRelocation - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation RevertRelocation(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.RevertRelocation"); - scope.Start(); - try - { - var response = _netAppVolumeVolumesRestClient.RevertRelocation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeVolumesClientDiagnostics, Pipeline, _netAppVolumeVolumesRestClient.CreateRevertRelocationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the latest status of the backup for a volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/latestBackupStatus/current - /// - /// - /// Operation Id - /// Backups_GetLatestStatus - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetLatestStatusBackupAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppVolumeResource.GetLatestStatusBackup"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupBackupsRestClient.GetLatestStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the latest status of the backup for a volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/latestBackupStatus/current - /// - /// - /// Operation Id - /// Backups_GetLatestStatus - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetLatestStatusBackup(CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppVolumeResource.GetLatestStatusBackup"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupBackupsRestClient.GetLatestStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the latest status of the restore for a volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/latestRestoreStatus/current - /// - /// - /// Operation Id - /// Backups_GetVolumeLatestRestoreStatus - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetVolumeLatestRestoreStatusBackupAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppVolumeResource.GetVolumeLatestRestoreStatusBackup"); - scope.Start(); - try - { - var response = await _netAppBackupVaultBackupBackupsRestClient.GetVolumeLatestRestoreStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get the latest status of the restore for a volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/latestRestoreStatus/current - /// - /// - /// Operation Id - /// Backups_GetVolumeLatestRestoreStatus - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetVolumeLatestRestoreStatusBackup(CancellationToken cancellationToken = default) - { - using var scope = _netAppBackupVaultBackupBackupsClientDiagnostics.CreateScope("NetAppVolumeResource.GetVolumeLatestRestoreStatusBackup"); - scope.Start(); - try - { - var response = _netAppBackupVaultBackupBackupsRestClient.GetVolumeLatestRestoreStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Migrate the backups under volume to backup vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/migrateBackups - /// - /// - /// Operation Id - /// BackupsUnderVolume_MigrateBackups - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Migrate backups under volume payload supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task MigrateBackupsBackupsUnderVolumeAsync(WaitUntil waitUntil, BackupsMigrationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _backupsUnderVolumeClientDiagnostics.CreateScope("NetAppVolumeResource.MigrateBackupsBackupsUnderVolume"); - scope.Start(); - try - { - var response = await _backupsUnderVolumeRestClient.MigrateBackupsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_backupsUnderVolumeClientDiagnostics, Pipeline, _backupsUnderVolumeRestClient.CreateMigrateBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Migrate the backups under volume to backup vault - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/migrateBackups - /// - /// - /// Operation Id - /// BackupsUnderVolume_MigrateBackups - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Migrate backups under volume payload supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation MigrateBackupsBackupsUnderVolume(WaitUntil waitUntil, BackupsMigrationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _backupsUnderVolumeClientDiagnostics.CreateScope("NetAppVolumeResource.MigrateBackupsBackupsUnderVolume"); - scope.Start(); - try - { - var response = _backupsUnderVolumeRestClient.MigrateBackups(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_backupsUnderVolumeClientDiagnostics, Pipeline, _backupsUnderVolumeRestClient.CreateMigrateBackupsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. - /// The cancellation token to use. - /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.AddTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues[key] = value; - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppVolumeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppVolumePatch(current.Location); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. - /// The cancellation token to use. - /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.AddTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppVolumeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppVolumePatch(current.Location); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. - /// The cancellation token to use. - /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tags, nameof(tags)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.SetTags"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppVolumeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppVolumePatch(current.Location); - patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. - /// The cancellation token to use. - /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tags, nameof(tags)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.SetTags"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppVolumeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppVolumePatch(current.Location); - patch.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The cancellation token to use. - /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.RemoveTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.Remove(key); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _netAppVolumeVolumesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new NetAppVolumeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new NetAppVolumePatch(current.Location); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName} - /// - /// - /// Operation Id - /// Volumes_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The cancellation token to use. - /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - - using var scope = _netAppVolumeVolumesClientDiagnostics.CreateScope("NetAppVolumeResource.RemoveTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _netAppVolumeVolumesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new NetAppVolumeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new NetAppVolumePatch(current.Location); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotCollection.cs deleted file mode 100644 index 0cfdcd542337..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotCollection.cs +++ /dev/null @@ -1,491 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetNetAppVolumeSnapshots method from an instance of . - /// - public partial class NetAppVolumeSnapshotCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _netAppVolumeSnapshotSnapshotsClientDiagnostics; - private readonly SnapshotsRestOperations _netAppVolumeSnapshotSnapshotsRestClient; - - /// Initializes a new instance of the class for mocking. - protected NetAppVolumeSnapshotCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal NetAppVolumeSnapshotCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppVolumeSnapshotSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", NetAppVolumeSnapshotResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(NetAppVolumeSnapshotResource.ResourceType, out string netAppVolumeSnapshotSnapshotsApiVersion); - _netAppVolumeSnapshotSnapshotsRestClient = new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppVolumeSnapshotSnapshotsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != NetAppVolumeResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetAppVolumeResource.ResourceType), nameof(id)); - } - - /// - /// Create the specified snapshot within the given volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the snapshot. - /// Snapshot object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string snapshotName, NetAppVolumeSnapshotData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _netAppVolumeSnapshotSnapshotsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeSnapshotOperationSource(Client), _netAppVolumeSnapshotSnapshotsClientDiagnostics, Pipeline, _netAppVolumeSnapshotSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create the specified snapshot within the given volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the snapshot. - /// Snapshot object supplied in the body of the operation. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string snapshotName, NetAppVolumeSnapshotData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _netAppVolumeSnapshotSnapshotsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeSnapshotOperationSource(Client), _netAppVolumeSnapshotSnapshotsClientDiagnostics, Pipeline, _netAppVolumeSnapshotSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified snapshot - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the snapshot. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string snapshotName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotCollection.Get"); - scope.Start(); - try - { - var response = await _netAppVolumeSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified snapshot - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the snapshot. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string snapshotName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotCollection.Get"); - scope.Start(); - try - { - var response = _netAppVolumeSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List all snapshots associated with the volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots - /// - /// - /// Operation Id - /// Snapshots_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppVolumeSnapshotSnapshotsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new NetAppVolumeSnapshotResource(Client, NetAppVolumeSnapshotData.DeserializeNetAppVolumeSnapshotData(e)), _netAppVolumeSnapshotSnapshotsClientDiagnostics, Pipeline, "NetAppVolumeSnapshotCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// List all snapshots associated with the volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots - /// - /// - /// Operation Id - /// Snapshots_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _netAppVolumeSnapshotSnapshotsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new NetAppVolumeSnapshotResource(Client, NetAppVolumeSnapshotData.DeserializeNetAppVolumeSnapshotData(e)), _netAppVolumeSnapshotSnapshotsClientDiagnostics, Pipeline, "NetAppVolumeSnapshotCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the snapshot. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string snapshotName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotCollection.Exists"); - scope.Start(); - try - { - var response = await _netAppVolumeSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the snapshot. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string snapshotName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotCollection.Exists"); - scope.Start(); - try - { - var response = _netAppVolumeSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the snapshot. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string snapshotName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _netAppVolumeSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the snapshot. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string snapshotName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotCollection.GetIfExists"); - scope.Start(); - try - { - var response = _netAppVolumeSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotData.Serialization.cs deleted file mode 100644 index 0188af36c450..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotData.Serialization.cs +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppVolumeSnapshotData : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeSnapshotData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(SnapshotId)) - { - writer.WritePropertyName("snapshotId"u8); - writer.WriteStringValue(SnapshotId); - } - if (options.Format != "W" && Optional.IsDefined(Created)) - { - writer.WritePropertyName("created"u8); - writer.WriteStringValue(Created.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - writer.WriteEndObject(); - } - - NetAppVolumeSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(NetAppVolumeSnapshotData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNetAppVolumeSnapshotData(document.RootElement, options); - } - - internal static NetAppVolumeSnapshotData DeserializeNetAppVolumeSnapshotData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string snapshotId = default; - DateTimeOffset? created = default; - string provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("snapshotId"u8)) - { - snapshotId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("created"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - created = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new NetAppVolumeSnapshotData( - id, - name, - type, - systemData, - location, - snapshotId, - created, - provisioningState, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); - default: - throw new FormatException($"The model {nameof(NetAppVolumeSnapshotData)} does not support writing '{options.Format}' format."); - } - } - - NetAppVolumeSnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNetAppVolumeSnapshotData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NetAppVolumeSnapshotData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotData.cs deleted file mode 100644 index 0a10393e5064..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotData.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing the NetAppVolumeSnapshot data model. - /// Snapshot of a Volume - /// - public partial class NetAppVolumeSnapshotData : ResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// Resource location. - public NetAppVolumeSnapshotData(AzureLocation location) - { - Location = location; - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Resource location. - /// UUID v4 used to identify the Snapshot. - /// The creation date of the snapshot. - /// Azure lifecycle management. - /// Keeps track of any properties unknown to the library. - internal NetAppVolumeSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation location, string snapshotId, DateTimeOffset? created, string provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Location = location; - SnapshotId = snapshotId; - Created = created; - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal NetAppVolumeSnapshotData() - { - } - - /// Resource location. - public AzureLocation Location { get; set; } - /// UUID v4 used to identify the Snapshot. - public string SnapshotId { get; } - /// The creation date of the snapshot. - public DateTimeOffset? Created { get; } - /// Azure lifecycle management. - public string ProvisioningState { get; } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.Serialization.cs deleted file mode 100644 index 9873b40a3bd3..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.NetApp -{ - public partial class NetAppVolumeSnapshotResource : IJsonModel - { - private static NetAppVolumeSnapshotData s_dataDeserializationInstance; - private static NetAppVolumeSnapshotData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - NetAppVolumeSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); - - NetAppVolumeSnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.cs deleted file mode 100644 index 9ddbbdc572e0..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeSnapshotResource.cs +++ /dev/null @@ -1,442 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A Class representing a NetAppVolumeSnapshot along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetNetAppVolumeSnapshotResource method. - /// Otherwise you can get one from its parent resource using the GetNetAppVolumeSnapshot method. - /// - public partial class NetAppVolumeSnapshotResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The poolName. - /// The volumeName. - /// The snapshotName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _netAppVolumeSnapshotSnapshotsClientDiagnostics; - private readonly SnapshotsRestOperations _netAppVolumeSnapshotSnapshotsRestClient; - private readonly NetAppVolumeSnapshotData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots"; - - /// Initializes a new instance of the class for mocking. - protected NetAppVolumeSnapshotResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal NetAppVolumeSnapshotResource(ArmClient client, NetAppVolumeSnapshotData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal NetAppVolumeSnapshotResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _netAppVolumeSnapshotSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string netAppVolumeSnapshotSnapshotsApiVersion); - _netAppVolumeSnapshotSnapshotsRestClient = new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, netAppVolumeSnapshotSnapshotsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual NetAppVolumeSnapshotData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Get details of the specified snapshot - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotResource.Get"); - scope.Start(); - try - { - var response = await _netAppVolumeSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get details of the specified snapshot - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotResource.Get"); - scope.Start(); - try - { - var response = _netAppVolumeSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new NetAppVolumeSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete snapshot - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotResource.Delete"); - scope.Start(); - try - { - var response = await _netAppVolumeSnapshotSnapshotsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeSnapshotSnapshotsClientDiagnostics, Pipeline, _netAppVolumeSnapshotSnapshotsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Delete snapshot - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Delete - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotResource.Delete"); - scope.Start(); - try - { - var response = _netAppVolumeSnapshotSnapshotsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeSnapshotSnapshotsClientDiagnostics, Pipeline, _netAppVolumeSnapshotSnapshotsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create the specified snapshot within the given volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Snapshot object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, NetAppVolumeSnapshotData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotResource.Update"); - scope.Start(); - try - { - var response = await _netAppVolumeSnapshotSnapshotsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new NetAppVolumeSnapshotOperationSource(Client), _netAppVolumeSnapshotSnapshotsClientDiagnostics, Pipeline, _netAppVolumeSnapshotSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create the specified snapshot within the given volume - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName} - /// - /// - /// Operation Id - /// Snapshots_Create - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Snapshot object supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, NetAppVolumeSnapshotData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotResource.Update"); - scope.Start(); - try - { - var response = _netAppVolumeSnapshotSnapshotsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new NetAppArmOperation(new NetAppVolumeSnapshotOperationSource(Client), _netAppVolumeSnapshotSnapshotsClientDiagnostics, Pipeline, _netAppVolumeSnapshotSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Restore the specified files from the specified snapshot to the active filesystem - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles - /// - /// - /// Operation Id - /// Snapshots_RestoreFiles - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Restore payload supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual async Task RestoreFilesAsync(WaitUntil waitUntil, NetAppVolumeSnapshotRestoreFilesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotResource.RestoreFiles"); - scope.Start(); - try - { - var response = await _netAppVolumeSnapshotSnapshotsRestClient.RestoreFilesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_netAppVolumeSnapshotSnapshotsClientDiagnostics, Pipeline, _netAppVolumeSnapshotSnapshotsRestClient.CreateRestoreFilesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Restore the specified files from the specified snapshot to the active filesystem - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles - /// - /// - /// Operation Id - /// Snapshots_RestoreFiles - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Restore payload supplied in the body of the operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation RestoreFiles(WaitUntil waitUntil, NetAppVolumeSnapshotRestoreFilesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _netAppVolumeSnapshotSnapshotsClientDiagnostics.CreateScope("NetAppVolumeSnapshotResource.RestoreFiles"); - scope.Start(); - try - { - var response = _netAppVolumeSnapshotSnapshotsRestClient.RestoreFiles(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new NetAppArmOperation(_netAppVolumeSnapshotSnapshotsClientDiagnostics, Pipeline, _netAppVolumeSnapshotSnapshotsRestClient.CreateRestoreFilesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/OperationsGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/OperationsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..9c9419e8cb86 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/OperationsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class OperationsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Operations _client; + private readonly RequestContext _context; + + /// Initializes a new instance of OperationsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Operations client used to send requests. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public OperationsGetAllAsyncCollectionResultOfT(Operations client, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _context = context; + } + + /// Gets the pages of OperationsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of OperationsGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + OperationListResult result = OperationListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _context) : _client.CreateGetAllRequest(_context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppTenantResource.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/OperationsGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/OperationsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..d997e2cd67d8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/OperationsGetAllCollectionResultOfT.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class OperationsGetAllCollectionResultOfT : Pageable + { + private readonly Operations _client; + private readonly RequestContext _context; + + /// Initializes a new instance of OperationsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Operations client used to send requests. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public OperationsGetAllCollectionResultOfT(Operations client, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _context = context; + } + + /// Gets the pages of OperationsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of OperationsGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + OperationListResult result = OperationListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _context) : _client.CreateGetAllRequest(_context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableNetAppTenantResource.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/PoolsGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/PoolsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..dcbe918be991 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/PoolsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class PoolsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Pools _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of PoolsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Pools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public PoolsGetAllAsyncCollectionResultOfT(Pools client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of PoolsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of PoolsGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + CapacityPoolList result = CapacityPoolList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("CapacityPoolCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/PoolsGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/PoolsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..31739badc2d1 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/PoolsGetAllCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class PoolsGetAllCollectionResultOfT : Pageable + { + private readonly Pools _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of PoolsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Pools client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public PoolsGetAllCollectionResultOfT(Pools client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of PoolsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of PoolsGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + CapacityPoolList result = CapacityPoolList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("CapacityPoolCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ProviderConstants.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ProviderConstants.cs index bfe58de1e330..53d4ce118a44 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ProviderConstants.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/ProviderConstants.cs @@ -9,8 +9,9 @@ namespace Azure.ResourceManager.NetApp { - internal static class ProviderConstants + internal static partial class ProviderConstants { + /// Gets the DefaultProviderNamespace. public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportCollection.cs new file mode 100644 index 000000000000..111c5878ba1b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportCollection.cs @@ -0,0 +1,467 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetRansomwareReports method from an instance of the parent resource. + /// + public partial class RansomwareReportCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _ransomwareReportsClientDiagnostics; + private readonly RansomwareReports _ransomwareReportsRestClient; + + /// Initializes a new instance of RansomwareReportCollection for mocking. + protected RansomwareReportCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal RansomwareReportCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(RansomwareReportResource.ResourceType, out string ransomwareReportApiVersion); + _ransomwareReportsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", RansomwareReportResource.ResourceType.Namespace, Diagnostics); + _ransomwareReportsRestClient = new RansomwareReports(_ransomwareReportsClientDiagnostics, Pipeline, Endpoint, ransomwareReportApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != VolumeResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, VolumeResource.ResourceType), id); + } + } + + /// + /// Get details of the specified ransomware report (ARP) + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}. + /// + /// + /// Operation Id. + /// RansomwareReports_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ransomware report. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string ransomwareReportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ransomwareReportName, nameof(ransomwareReportName)); + + using DiagnosticScope scope = _ransomwareReportsClientDiagnostics.CreateScope("RansomwareReportCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _ransomwareReportsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ransomwareReportName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(RansomwareReportData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new RansomwareReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified ransomware report (ARP) + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}. + /// + /// + /// Operation Id. + /// RansomwareReports_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ransomware report. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string ransomwareReportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ransomwareReportName, nameof(ransomwareReportName)); + + using DiagnosticScope scope = _ransomwareReportsClientDiagnostics.CreateScope("RansomwareReportCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _ransomwareReportsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ransomwareReportName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(RansomwareReportData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new RansomwareReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all ransomware reports for the volume + /// Returns a list of the Advanced Ransomware Protection (ARP) reports for the volume. + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data" + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new RansomwareReportsGetAllAsyncCollectionResultOfT( + _ransomwareReportsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new RansomwareReportResource(Client, data)); + } + + /// + /// List all ransomware reports for the volume + /// Returns a list of the Advanced Ransomware Protection (ARP) reports for the volume. + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data" + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new RansomwareReportsGetAllCollectionResultOfT( + _ransomwareReportsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new RansomwareReportResource(Client, data)); + } + + /// + /// Get details of the specified ransomware report (ARP) + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}. + /// + /// + /// Operation Id. + /// RansomwareReports_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ransomware report. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string ransomwareReportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ransomwareReportName, nameof(ransomwareReportName)); + + using DiagnosticScope scope = _ransomwareReportsClientDiagnostics.CreateScope("RansomwareReportCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _ransomwareReportsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ransomwareReportName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(RansomwareReportData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((RansomwareReportData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified ransomware report (ARP) + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}. + /// + /// + /// Operation Id. + /// RansomwareReports_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ransomware report. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string ransomwareReportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ransomwareReportName, nameof(ransomwareReportName)); + + using DiagnosticScope scope = _ransomwareReportsClientDiagnostics.CreateScope("RansomwareReportCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _ransomwareReportsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ransomwareReportName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(RansomwareReportData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((RansomwareReportData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified ransomware report (ARP) + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}. + /// + /// + /// Operation Id. + /// RansomwareReports_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ransomware report. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string ransomwareReportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ransomwareReportName, nameof(ransomwareReportName)); + + using DiagnosticScope scope = _ransomwareReportsClientDiagnostics.CreateScope("RansomwareReportCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _ransomwareReportsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ransomwareReportName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(RansomwareReportData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((RansomwareReportData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new RansomwareReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified ransomware report (ARP) + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}. + /// + /// + /// Operation Id. + /// RansomwareReports_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the ransomware report. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string ransomwareReportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ransomwareReportName, nameof(ransomwareReportName)); + + using DiagnosticScope scope = _ransomwareReportsClientDiagnostics.CreateScope("RansomwareReportCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _ransomwareReportsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ransomwareReportName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(RansomwareReportData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((RansomwareReportData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new RansomwareReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportData.Serialization.cs new file mode 100644 index 000000000000..c0993e36ac88 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportData.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// Advanced Ransomware Protection (ARP) report + /// Get details of the specified Advanced Ransomware Protection report (ARP). + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + public partial class RansomwareReportData : ResourceData, IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareReportData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + RansomwareReportData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (RansomwareReportData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RansomwareReportData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRansomwareReportData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RansomwareReportData DeserializeRansomwareReportData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + RansomwareReportProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = RansomwareReportProperties.DeserializeRansomwareReportProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new RansomwareReportData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(RansomwareReportData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + RansomwareReportData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (RansomwareReportData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeRansomwareReportData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RansomwareReportData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static RansomwareReportData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeRansomwareReportData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportData.cs new file mode 100644 index 000000000000..43eff34998e5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportData.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// Advanced Ransomware Protection (ARP) report + /// Get details of the specified Advanced Ransomware Protection report (ARP). + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + public partial class RansomwareReportData : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal RansomwareReportData() + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Advanced Ransomware Protection reports Properties. + internal RansomwareReportData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, RansomwareReportProperties properties) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// Advanced Ransomware Protection reports Properties. + public RansomwareReportProperties Properties { get; } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportResource.Serialization.cs new file mode 100644 index 000000000000..d62461e7b274 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class RansomwareReportResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new RansomwareReportData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + RansomwareReportData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + RansomwareReportData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportResource.cs new file mode 100644 index 000000000000..a533ca14ab0a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportResource.cs @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a RansomwareReport along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetRansomwareReports method. + /// + public partial class RansomwareReportResource : ArmResource + { + private readonly ClientDiagnostics _ransomwareReportsClientDiagnostics; + private readonly RansomwareReports _ransomwareReportsRestClient; + private readonly RansomwareReportData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/ransomwareReports"; + + /// Initializes a new instance of RansomwareReportResource for mocking. + protected RansomwareReportResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal RansomwareReportResource(ArmClient client, RansomwareReportData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal RansomwareReportResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string ransomwareReportApiVersion); + _ransomwareReportsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _ransomwareReportsRestClient = new RansomwareReports(_ransomwareReportsClientDiagnostics, Pipeline, Endpoint, ransomwareReportApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual RansomwareReportData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + /// The ransomwareReportName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string ransomwareReportName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get details of the specified ransomware report (ARP) + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}. + /// + /// + /// Operation Id. + /// RansomwareReports_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _ransomwareReportsClientDiagnostics.CreateScope("RansomwareReportResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _ransomwareReportsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(RansomwareReportData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new RansomwareReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified ransomware report (ARP) + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}. + /// + /// + /// Operation Id. + /// RansomwareReports_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _ransomwareReportsClientDiagnostics.CreateScope("RansomwareReportResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _ransomwareReportsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(RansomwareReportData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new RansomwareReportResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// "Clear ransomware suspects for the given Advanced Ransomware Protection report. You should evaluate the report to determine whether the activity is acceptable (false positive) or whether an attack seems malicious. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data", + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}/clearSuspects. + /// + /// + /// Operation Id. + /// RansomwareReports_ClearSuspects. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Clear suspects request object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task ClearSuspectsAsync(WaitUntil waitUntil, RansomwareSuspectsClearRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _ransomwareReportsClientDiagnostics.CreateScope("RansomwareReportResource.ClearSuspects"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _ransomwareReportsRestClient.CreateClearSuspectsRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, RansomwareSuspectsClearRequest.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_ransomwareReportsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// "Clear ransomware suspects for the given Advanced Ransomware Protection report. You should evaluate the report to determine whether the activity is acceptable (false positive) or whether an attack seems malicious. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data", + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/ransomwareReports/{ransomwareReportName}/clearSuspects. + /// + /// + /// Operation Id. + /// RansomwareReports_ClearSuspects. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Clear suspects request object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation ClearSuspects(WaitUntil waitUntil, RansomwareSuspectsClearRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _ransomwareReportsClientDiagnostics.CreateScope("RansomwareReportResource.ClearSuspects"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _ransomwareReportsRestClient.CreateClearSuspectsRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, RansomwareSuspectsClearRequest.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_ransomwareReportsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportsGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..b7282d3b1fdc --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class RansomwareReportsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly RansomwareReports _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of RansomwareReportsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The RansomwareReports client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public RansomwareReportsGetAllAsyncCollectionResultOfT(RansomwareReports client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of RansomwareReportsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of RansomwareReportsGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + RansomwareReportsList result = RansomwareReportsList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("RansomwareReportCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportsGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..8152fd4c6997 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RansomwareReportsGetAllCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class RansomwareReportsGetAllCollectionResultOfT : Pageable + { + private readonly RansomwareReports _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of RansomwareReportsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The RansomwareReports client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public RansomwareReportsGetAllCollectionResultOfT(RansomwareReports client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of RansomwareReportsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of RansomwareReportsGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + RansomwareReportsList result = RansomwareReportsList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("RansomwareReportCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResource.Serialization.cs index 8c50b20edade..3b6b6d9c0bc4 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResource.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.NetApp { + /// public partial class RegionInfoResource : IJsonModel { - private static RegionInfoResourceData s_dataDeserializationInstance; - private static RegionInfoResourceData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new RegionInfoResourceData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - RegionInfoResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + RegionInfoResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. RegionInfoResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResource.cs index aa76c3cd9b34..928e8b1c5836 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResource.cs @@ -6,45 +6,36 @@ #nullable disable using System; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NetApp { /// - /// A Class representing a RegionInfoResource along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetRegionInfoResource method. + /// A class representing a RegionInfoResource along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. /// Otherwise you can get one from its parent resource using the GetRegionInfoResource method. /// public partial class RegionInfoResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The location. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location) - { - var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics; - private readonly NetAppResourceRegionInfosRestOperations _regionInfoResourceNetAppResourceRegionInfosRestClient; + private readonly ClientDiagnostics _netAppResourceRegionInfosClientDiagnostics; + private readonly NetAppResourceRegionInfos _netAppResourceRegionInfosRestClient; private readonly RegionInfoResourceData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.NetApp/locations/regionInfos"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of RegionInfoResource for mocking. protected RegionInfoResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal RegionInfoResource(ArmClient client, RegionInfoResourceData data) : this(client, data.Id) @@ -53,71 +44,91 @@ internal RegionInfoResource(ArmClient client, RegionInfoResourceData data) : thi _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal RegionInfoResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string regionInfoResourceNetAppResourceRegionInfosApiVersion); - _regionInfoResourceNetAppResourceRegionInfosRestClient = new NetAppResourceRegionInfosRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, regionInfoResourceNetAppResourceRegionInfosApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string regionInfoResourceApiVersion); + _netAppResourceRegionInfosClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _netAppResourceRegionInfosRestClient = new NetAppResourceRegionInfos(_netAppResourceRegionInfosClientDiagnostics, Pipeline, Endpoint, regionInfoResourceApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); } /// Gets whether or not the current instance has data. public virtual bool HasData { get; } /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. public virtual RegionInfoResourceData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The location. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location) + { + string resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Provides storage to network proximity and logical zone mapping information. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default. /// /// - /// Operation Id - /// NetAppResourceRegionInfos_Get + /// Operation Id. + /// RegionInfoResources_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics.CreateScope("RegionInfoResource.Get"); + using DiagnosticScope scope = _netAppResourceRegionInfosClientDiagnostics.CreateScope("RegionInfoResource.Get"); scope.Start(); try { - var response = await _regionInfoResourceNetAppResourceRegionInfosRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceRegionInfosRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.Parent.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(RegionInfoResourceData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new RegionInfoResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -131,33 +142,41 @@ public virtual async Task> GetAsync(CancellationTok /// Provides storage to network proximity and logical zone mapping information. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default. /// /// - /// Operation Id - /// NetAppResourceRegionInfos_Get + /// Operation Id. + /// RegionInfoResources_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics.CreateScope("RegionInfoResource.Get"); + using DiagnosticScope scope = _netAppResourceRegionInfosClientDiagnostics.CreateScope("RegionInfoResource.Get"); scope.Start(); try { - var response = _regionInfoResourceNetAppResourceRegionInfosRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _netAppResourceRegionInfosRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.Parent.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(RegionInfoResourceData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new RegionInfoResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceCollection.cs deleted file mode 100644 index 2f59b4b13a9e..000000000000 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceCollection.cs +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Resources; - -namespace Azure.ResourceManager.NetApp -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetRegionInfoResources method from an instance of . - /// - public partial class RegionInfoResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics; - private readonly NetAppResourceRegionInfosRestOperations _regionInfoResourceNetAppResourceRegionInfosRestClient; - private readonly AzureLocation _location; - - /// Initializes a new instance of the class for mocking. - protected RegionInfoResourceCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - /// The name of the Azure region. - internal RegionInfoResourceCollection(ArmClient client, ResourceIdentifier id, AzureLocation location) : base(client, id) - { - _location = location; - _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", RegionInfoResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(RegionInfoResource.ResourceType, out string regionInfoResourceNetAppResourceRegionInfosApiVersion); - _regionInfoResourceNetAppResourceRegionInfosRestClient = new NetAppResourceRegionInfosRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, regionInfoResourceNetAppResourceRegionInfosApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != SubscriptionResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); - } - - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics.CreateScope("RegionInfoResourceCollection.Get"); - scope.Start(); - try - { - var response = await _regionInfoResourceNetAppResourceRegionInfosRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new RegionInfoResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Provides storage to network proximity and logical zone mapping information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics.CreateScope("RegionInfoResourceCollection.Get"); - scope.Start(); - try - { - var response = _regionInfoResourceNetAppResourceRegionInfosRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new RegionInfoResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Provides region specific information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _regionInfoResourceNetAppResourceRegionInfosRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(_location)); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _regionInfoResourceNetAppResourceRegionInfosRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RegionInfoResource(Client, RegionInfoResourceData.DeserializeRegionInfoResourceData(e)), _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics, Pipeline, "RegionInfoResourceCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Provides region specific information. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _regionInfoResourceNetAppResourceRegionInfosRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(_location)); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _regionInfoResourceNetAppResourceRegionInfosRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RegionInfoResource(Client, RegionInfoResourceData.DeserializeRegionInfoResourceData(e)), _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics, Pipeline, "RegionInfoResourceCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> ExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics.CreateScope("RegionInfoResourceCollection.Exists"); - scope.Start(); - try - { - var response = await _regionInfoResourceNetAppResourceRegionInfosRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Exists(CancellationToken cancellationToken = default) - { - using var scope = _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics.CreateScope("RegionInfoResourceCollection.Exists"); - scope.Start(); - try - { - var response = _regionInfoResourceNetAppResourceRegionInfosRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetIfExistsAsync(CancellationToken cancellationToken = default) - { - using var scope = _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics.CreateScope("RegionInfoResourceCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _regionInfoResourceNetAppResourceRegionInfosRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new RegionInfoResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default - /// - /// - /// Operation Id - /// NetAppResourceRegionInfos_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual NullableResponse GetIfExists(CancellationToken cancellationToken = default) - { - using var scope = _regionInfoResourceNetAppResourceRegionInfosClientDiagnostics.CreateScope("RegionInfoResourceCollection.GetIfExists"); - scope.Start(); - try - { - var response = _regionInfoResourceNetAppResourceRegionInfosRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new RegionInfoResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceData.Serialization.cs index 6198695ccdc3..432856d5e698 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceData.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceData.Serialization.cs @@ -10,16 +10,18 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - public partial class RegionInfoResourceData : IUtf8JsonSerializable, IJsonModel + /// Information regarding regionInfo Item. + public partial class RegionInfoResourceData : ResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,142 +33,114 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(RegionInfoResourceData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(StorageToNetworkProximity)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("storageToNetworkProximity"u8); - writer.WriteStringValue(StorageToNetworkProximity.Value.ToString()); - } - if (Optional.IsCollectionDefined(AvailabilityZoneMappings)) - { - writer.WritePropertyName("availabilityZoneMappings"u8); - writer.WriteStartArray(); - foreach (var item in AvailabilityZoneMappings) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } - RegionInfoResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + RegionInfoResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (RegionInfoResourceData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(RegionInfoResourceData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeRegionInfoResourceData(document.RootElement, options); } - internal static RegionInfoResourceData DeserializeRegionInfoResourceData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static RegionInfoResourceData DeserializeRegionInfoResourceData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - RegionStorageToNetworkProximity? storageToNetworkProximity = default; - IList availabilityZoneMappings = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + RegionInfo properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (prop.NameEquals("id"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("type"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("storageToNetworkProximity"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - storageToNetworkProximity = new RegionStorageToNetworkProximity(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("availabilityZoneMappings"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(AvailabilityZoneMapping.DeserializeAvailabilityZoneMapping(item, options)); - } - availabilityZoneMappings = array; - continue; - } - } + properties = RegionInfo.DeserializeRegionInfo(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new RegionInfoResourceData( id, name, - type, + resourceType, systemData, - storageToNetworkProximity, - availabilityZoneMappings ?? new ChangeTrackingList(), - serializedAdditionalRawData); + additionalBinaryDataProperties, + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -176,15 +150,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti } } - RegionInfoResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + RegionInfoResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (RegionInfoResourceData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeRegionInfoResourceData(document.RootElement, options); } default: @@ -192,6 +171,15 @@ RegionInfoResourceData IPersistableModel.Create(BinaryDa } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static RegionInfoResourceData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeRegionInfoResourceData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceData.cs index 4094a23f3bcb..4a5ba0929023 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceData.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RegionInfoResourceData.cs @@ -13,68 +13,49 @@ namespace Azure.ResourceManager.NetApp { - /// - /// A class representing the RegionInfoResource data model. - /// Information regarding regionInfo Item. - /// + /// Information regarding regionInfo Item. public partial class RegionInfoResourceData : ResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - public RegionInfoResourceData() + internal RegionInfoResourceData() { - AvailabilityZoneMappings = new ChangeTrackingList(); } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Provides storage to network proximity information in the region. - /// Provides logical availability zone mappings for the subscription for a region. - /// Keeps track of any properties unknown to the library. - internal RegionInfoResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RegionStorageToNetworkProximity? storageToNetworkProximity, IList availabilityZoneMappings, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// regionInfo properties. + internal RegionInfoResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, RegionInfo properties) : base(id, name, resourceType, systemData) { - StorageToNetworkProximity = storageToNetworkProximity; - AvailabilityZoneMappings = availabilityZoneMappings; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } + /// regionInfo properties. + internal RegionInfo Properties { get; } + /// Provides storage to network proximity information in the region. - public RegionStorageToNetworkProximity? StorageToNetworkProximity { get; set; } + public RegionStorageToNetworkProximity? StorageToNetworkProximity + { + get + { + return Properties.StorageToNetworkProximity; + } + } + /// Provides logical availability zone mappings for the subscription for a region. - public IList AvailabilityZoneMappings { get; } + public IList AvailabilityZoneMappings + { + get + { + return Properties.AvailabilityZoneMappings; + } + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/AccountsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/AccountsRestOperations.cs index 477d7c330efc..74369b49c2e7 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/AccountsRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/AccountsRestOperations.cs @@ -6,1076 +6,263 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class AccountsRestOperations + internal partial class Accounts { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of AccountsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public AccountsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List and describe all NetApp accounts in the subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + /// Initializes a new instance of Accounts for mocking. + protected Accounts() { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppAccountList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppAccountList.DeserializeNetAppAccountList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } } - /// List and describe all NetApp accounts in the subscription. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppAccountList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppAccountList.DeserializeNetAppAccountList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName) + /// Initializes a new instance of Accounts. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal Accounts(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List and describe all NetApp accounts in the resource group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppAccountList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppAccountList.DeserializeNetAppAccountList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - /// List and describe all NetApp accounts in the resource group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppAccountList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppAccountList.DeserializeNetAppAccountList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get the NetApp account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppAccountData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppAccountData.DeserializeNetAppAccountData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppAccountData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the NetApp account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppAccountData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppAccountData.DeserializeNetAppAccountData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppAccountData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, NetAppAccountData data) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, NetAppAccountData data) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or update the specified NetApp account within the resource group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// NetApp Account object supplied in the body of the operation. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string accountName, NetAppAccountData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or update the specified NetApp account within the resource group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// NetApp Account object supplied in the body of the operation. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string accountName, NetAppAccountData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string resourceGroupName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Delete the specified NetApp account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete the specified NetApp account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, NetAppAccountPatch patch) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, NetAppAccountPatch patch) + internal HttpMessage CreateGetBySubscriptionRequest(Guid subscriptionId, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Patch the specified NetApp account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// NetApp Account object supplied in the body of the operation. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, NetAppAccountPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Patch the specified NetApp account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// NetApp Account object supplied in the body of the operation. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string accountName, NetAppAccountPatch patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetBySubscriptionRequest(Uri nextPage, Guid subscriptionId, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRenewCredentialsRequestUri(string subscriptionId, string resourceGroupName, string accountName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/renewCredentials", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateRenewCredentialsRequest(string subscriptionId, string resourceGroupName, string accountName) + internal HttpMessage CreateRenewCredentialsRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/renewCredentials", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; return message; } - /// Renew identity credentials that are used to authenticate to key vault, for customer-managed key encryption. If encryption.identity.principalId does not match identity.principalId, running this operation will fix it. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task RenewCredentialsAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateRenewCredentialsRequest(subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Renew identity credentials that are used to authenticate to key vault, for customer-managed key encryption. If encryption.identity.principalId does not match identity.principalId, running this operation will fix it. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response RenewCredentials(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateRenewCredentialsRequest(subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateTransitionToCmkRequestUri(string subscriptionId, string resourceGroupName, string accountName, NetAppEncryptionTransitionContent content) + internal HttpMessage CreateTransitionToCmkRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/transitiontocmk", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateTransitionToCmkRequest(string subscriptionId, string resourceGroupName, string accountName, NetAppEncryptionTransitionContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/transitiontocmk", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (content != null) + request.Method = RequestMethod.Post; + if ("application/json" != null) { - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; + request.Headers.SetValue("Content-Type", "application/json"); } - _userAgent.Apply(message); + request.Content = content; return message; } - /// Transitions all volumes in a VNet to a different encryption key source (Microsoft-managed key or Azure Key Vault). Operation fails if targeted volumes share encryption sibling set with volumes from another account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The required parameters to perform encryption transition. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task TransitionToCmkAsync(string subscriptionId, string resourceGroupName, string accountName, NetAppEncryptionTransitionContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateTransitionToCmkRequest(subscriptionId, resourceGroupName, accountName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Transitions all volumes in a VNet to a different encryption key source (Microsoft-managed key or Azure Key Vault). Operation fails if targeted volumes share encryption sibling set with volumes from another account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The required parameters to perform encryption transition. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response TransitionToCmk(string subscriptionId, string resourceGroupName, string accountName, NetAppEncryptionTransitionContent content = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetChangeKeyVaultInformationRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateTransitionToCmkRequest(subscriptionId, resourceGroupName, accountName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetChangeKeyVaultInformationRequestUri(string subscriptionId, string resourceGroupName, string accountName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/getKeyVaultStatus", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetChangeKeyVaultInformationRequest(string subscriptionId, string resourceGroupName, string accountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/getKeyVaultStatus", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Contains data from encryption.keyVaultProperties as well as information about which private endpoint is used by each encryption sibling set. Response from this endpoint can be modified and used as request body for POST request. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task GetChangeKeyVaultInformationAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateGetChangeKeyVaultInformationRequest(subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Contains data from encryption.keyVaultProperties as well as information about which private endpoint is used by each encryption sibling set. Response from this endpoint can be modified and used as request body for POST request. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response GetChangeKeyVaultInformation(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + internal HttpMessage CreateChangeKeyVaultRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateGetChangeKeyVaultInformationRequest(subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateChangeKeyVaultRequestUri(string subscriptionId, string resourceGroupName, string accountName, NetAppChangeKeyVault body) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/changeKeyVault", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateChangeKeyVaultRequest(string subscriptionId, string resourceGroupName, string accountName, NetAppChangeKeyVault body) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/changeKeyVault", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (body != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body, ModelSerializationExtensions.WireOptions); - request.Content = content; - } - _userAgent.Apply(message); - return message; - } - - /// Affects existing volumes that are encrypted with Key Vault/Managed HSM, and new volumes. Supports HSM to Key Vault, Key Vault to HSM, HSM to HSM and Key Vault to Key Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The required parameters to perform encryption migration. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task ChangeKeyVaultAsync(string subscriptionId, string resourceGroupName, string accountName, NetAppChangeKeyVault body = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateChangeKeyVaultRequest(subscriptionId, resourceGroupName, accountName, body); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Affects existing volumes that are encrypted with Key Vault/Managed HSM, and new volumes. Supports HSM to Key Vault, Key Vault to HSM, HSM to HSM and Key Vault to Key Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The required parameters to perform encryption migration. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ChangeKeyVault(string subscriptionId, string resourceGroupName, string accountName, NetAppChangeKeyVault body = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateChangeKeyVaultRequest(subscriptionId, resourceGroupName, accountName, body); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List and describe all NetApp accounts in the subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppAccountList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppAccountList.DeserializeNetAppAccountList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List and describe all NetApp accounts in the subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + request.Method = RequestMethod.Post; + if ("application/json" != null) { - case 200: - { - NetAppAccountList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppAccountList.DeserializeNetAppAccountList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + request.Headers.SetValue("Content-Type", "application/json"); } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Content = content; return message; } - - /// List and describe all NetApp accounts in the resource group. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppAccountList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppAccountList.DeserializeNetAppAccountList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List and describe all NetApp accounts in the resource group. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppAccountList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppAccountList.DeserializeNetAppAccountList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ActiveDirectoryConfigsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ActiveDirectoryConfigsRestOperations.cs new file mode 100644 index 000000000000..78e9623b5be7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ActiveDirectoryConfigsRestOperations.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ActiveDirectoryConfigs + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ActiveDirectoryConfigs for mocking. + protected ActiveDirectoryConfigs() + { + } + + /// Initializes a new instance of ActiveDirectoryConfigs. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ActiveDirectoryConfigs(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string activeDirectoryConfigName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/activeDirectoryConfigs/", false); + uri.AppendPath(activeDirectoryConfigName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string activeDirectoryConfigName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/activeDirectoryConfigs/", false); + uri.AppendPath(activeDirectoryConfigName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string activeDirectoryConfigName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/activeDirectoryConfigs/", false); + uri.AppendPath(activeDirectoryConfigName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string activeDirectoryConfigName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/activeDirectoryConfigs/", false); + uri.AppendPath(activeDirectoryConfigName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByResourceGroupRequest(Guid subscriptionId, string resourceGroupName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/activeDirectoryConfigs", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetByResourceGroupRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetBySubscriptionRequest(Guid subscriptionId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.NetApp/activeDirectoryConfigs", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetBySubscriptionRequest(Uri nextPage, Guid subscriptionId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupPoliciesRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupPoliciesRestOperations.cs index 5f546e001e1c..5c39dd92451a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupPoliciesRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupPoliciesRestOperations.cs @@ -6,155 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class BackupPoliciesRestOperations + internal partial class BackupPolicies { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of BackupPoliciesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public BackupPoliciesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupPolicies", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName) + /// Initializes a new instance of BackupPolicies for mocking. + protected BackupPolicies() { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupPolicies", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// List backup policies for Netapp Account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + /// Initializes a new instance of BackupPolicies. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal BackupPolicies(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BackupPoliciesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = BackupPoliciesList.DeserializeBackupPoliciesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List backup policies for Netapp Account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BackupPoliciesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = BackupPoliciesList.DeserializeBackupPoliciesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupPolicies/", false); - uri.AppendPath(backupPolicyName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -162,103 +54,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/backupPolicies/", false); uri.AppendPath(backupPolicyName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get a particular backup Policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, backupPolicyName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppBackupPolicyData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppBackupPolicyData.DeserializeNetAppBackupPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppBackupPolicyData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a particular backup Policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, backupPolicyName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppBackupPolicyData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppBackupPolicyData.DeserializeNetAppBackupPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppBackupPolicyData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, NetAppBackupPolicyData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupPolicies/", false); - uri.AppendPath(backupPolicyName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, NetAppBackupPolicyData data) + internal HttpMessage CreateCreateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -266,101 +75,22 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendPath("/backupPolicies/", false); uri.AppendPath(backupPolicyName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create a backup policy for Netapp Account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// Backup policy Name which uniquely identify backup policy. - /// Backup policy object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, NetAppBackupPolicyData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, backupPolicyName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a backup policy for Netapp Account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// Backup policy Name which uniquely identify backup policy. - /// Backup policy object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, NetAppBackupPolicyData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, backupPolicyName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, NetAppBackupPolicyPatch patch) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupPolicies/", false); - uri.AppendPath(backupPolicyName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, NetAppBackupPolicyPatch patch) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -368,80 +98,22 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath("/backupPolicies/", false); uri.AppendPath(backupPolicyName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Patch a backup policy for Netapp Account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// Backup policy Name which uniquely identify backup policy. - /// Backup policy object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, NetAppBackupPolicyPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, backupPolicyName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Patch a backup policy for Netapp Account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// Backup policy Name which uniquely identify backup policy. - /// Backup policy object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, NetAppBackupPolicyPatch patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, backupPolicyName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -449,85 +121,43 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/backupPolicies/", false); uri.AppendPath(backupPolicyName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendPath("/backupPolicies/", false); - uri.AppendPath(backupPolicyName, true); + uri.AppendPath("/backupPolicies", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Delete backup policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, backupPolicyName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete backup policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// Backup policy Name which uniquely identify backup policy. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupPolicyName, nameof(backupPolicyName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, backupPolicyName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupVaultsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupVaultsRestOperations.cs index 316e1b913641..3e9bda1b3d00 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupVaultsRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupVaultsRestOperations.cs @@ -6,155 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class BackupVaultsRestOperations + internal partial class BackupVaults { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of BackupVaultsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public BackupVaultsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListByNetAppAccountRequestUri(string subscriptionId, string resourceGroupName, string accountName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByNetAppAccountRequest(string subscriptionId, string resourceGroupName, string accountName) + /// Initializes a new instance of BackupVaults for mocking. + protected BackupVaults() { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// List and describe all Backup Vaults in the NetApp account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByNetAppAccountAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + /// Initializes a new instance of BackupVaults. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal BackupVaults(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListByNetAppAccountRequest(subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BackupVaultsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = BackupVaultsList.DeserializeBackupVaultsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List and describe all Backup Vaults in the NetApp account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByNetAppAccount(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListByNetAppAccountRequest(subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BackupVaultsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = BackupVaultsList.DeserializeBackupVaultsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults/", false); - uri.AppendPath(backupVaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -162,103 +54,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/backupVaults/", false); uri.AppendPath(backupVaultName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get the Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, backupVaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppBackupVaultData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppBackupVaultData.DeserializeNetAppBackupVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppBackupVaultData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, backupVaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppBackupVaultData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppBackupVaultData.DeserializeNetAppBackupVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppBackupVaultData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, NetAppBackupVaultData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults/", false); - uri.AppendPath(backupVaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, NetAppBackupVaultData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -266,99 +75,22 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/backupVaults/", false); uri.AppendPath(backupVaultName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or update the specified Backup Vault in the NetApp account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// BackupVault object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, NetAppBackupVaultData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or update the specified Backup Vault in the NetApp account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// BackupVault object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, NetAppBackupVaultData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, NetAppBackupVaultPatch patch) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults/", false); - uri.AppendPath(backupVaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, NetAppBackupVaultPatch patch) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -366,80 +98,22 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath("/backupVaults/", false); uri.AppendPath(backupVaultName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Patch the specified NetApp Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// Backup Vault object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, NetAppBackupVaultPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Patch the specified NetApp Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// Backup Vault object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, NetAppBackupVaultPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -447,167 +121,43 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/backupVaults/", false); uri.AppendPath(backupVaultName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName) + internal HttpMessage CreateGetByNetAppAccountRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults/", false); - uri.AppendPath(backupVaultName, true); + uri.AppendPath("/backupVaults", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Delete the specified Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, backupVaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete the specified Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, backupVaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByNetAppAccountNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + internal HttpMessage CreateNextGetByNetAppAccountRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByNetAppAccountNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List and describe all Backup Vaults in the NetApp account. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByNetAppAccountNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListByNetAppAccountNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BackupVaultsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = BackupVaultsList.DeserializeBackupVaultsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List and describe all Backup Vaults in the NetApp account. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByNetAppAccountNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListByNetAppAccountNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BackupVaultsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = BackupVaultsList.DeserializeBackupVaultsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsRestOperations.cs index 723453069574..96fce44c76dc 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsRestOperations.cs @@ -6,368 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class BackupsRestOperations + internal partial class Backups { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of BackupsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public BackupsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGetLatestStatusRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/latestBackupStatus/current", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetLatestStatusRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/latestBackupStatus/current", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get the latest status of the backup for a volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> GetLatestStatusAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateGetLatestStatusRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeBackupStatus value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppVolumeBackupStatus.DeserializeNetAppVolumeBackupStatus(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the latest status of the backup for a volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response GetLatestStatus(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) + /// Initializes a new instance of Backups for mocking. + protected Backups() { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateGetLatestStatusRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeBackupStatus value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppVolumeBackupStatus.DeserializeNetAppVolumeBackupStatus(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } } - internal RequestUriBuilder CreateGetVolumeLatestRestoreStatusRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/latestRestoreStatus/current", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetVolumeLatestRestoreStatusRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/latestRestoreStatus/current", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get the latest status of the restore for a volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> GetVolumeLatestRestoreStatusAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateGetVolumeLatestRestoreStatusRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppRestoreStatus value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppRestoreStatus.DeserializeNetAppRestoreStatus(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the latest status of the restore for a volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response GetVolumeLatestRestoreStatus(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateGetVolumeLatestRestoreStatusRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppRestoreStatus value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppRestoreStatus.DeserializeNetAppRestoreStatus(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByVaultRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults/", false); - uri.AppendPath(backupVaultName, true); - uri.AppendPath("/backups", false); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - /// List all backups Under a Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByVaultAsync(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of Backups. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal Backups(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var message = CreateListByVaultRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BackupsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = BackupsList.DeserializeBackupsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List all backups Under a Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListByVault(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListByVaultRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BackupsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = BackupsList.DeserializeBackupsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults/", false); - uri.AppendPath(backupVaultName, true); - uri.AppendPath("/backups/", false); - uri.AppendPath(backupName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -377,88 +56,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/backups/", false); uri.AppendPath(backupName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get the specified Backup under Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The name of the backup. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, backupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppBackupData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppBackupData.DeserializeNetAppBackupData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppBackupData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the specified Backup under Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The name of the backup. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, backupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppBackupData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppBackupData.DeserializeNetAppBackupData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppBackupData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppBackupData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -468,18 +79,22 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string uri.AppendPath("/backups/", false); uri.AppendPath(backupName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppBackupData data) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -489,84 +104,25 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendPath("/backups/", false); uri.AppendPath(backupName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create a backup under the Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The name of the backup. - /// Backup object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppBackupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, backupName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a backup under the Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The name of the backup. - /// Backup object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppBackupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, backupName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + request.Method = RequestMethod.Patch; + if ("application/json" != null) { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); + request.Headers.SetValue("Content-Type", "application/json"); } + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppBackupVaultBackupPatch patch) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -576,287 +132,97 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string uri.AppendPath("/backups/", false); uri.AppendPath(backupName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppBackupVaultBackupPatch patch) + internal HttpMessage CreateGetByVaultRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/backupVaults/", false); uri.AppendPath(backupVaultName, true); - uri.AppendPath("/backups/", false); - uri.AppendPath(backupName, true); + uri.AppendPath("/backups", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Patch a Backup under the Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The name of the backup. - /// Backup object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppBackupVaultBackupPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, backupName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - /// Patch a Backup under the Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The name of the backup. - /// Backup object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppBackupVaultBackupPatch patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetByVaultRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, backupName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName) + internal HttpMessage CreateGetLatestStatusRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults/", false); - uri.AppendPath(backupVaultName, true); - uri.AppendPath("/backups/", false); - uri.AppendPath(backupName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/volumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/latestBackupStatus/current", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName) + internal HttpMessage CreateGetVolumeLatestRestoreStatusRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults/", false); - uri.AppendPath(backupVaultName, true); - uri.AppendPath("/backups/", false); - uri.AppendPath(backupName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/volumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/latestRestoreStatus/current", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete a Backup under the Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The name of the backup. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, backupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a Backup under the Backup Vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The name of the backup. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, backupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByVaultNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByVaultNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List all backups Under a Backup Vault. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByVaultNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var message = CreateListByVaultNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, backupVaultName, filter); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BackupsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = BackupsList.DeserializeBackupsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List all backups Under a Backup Vault. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListByVaultNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string filter = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - - using var message = CreateListByVaultNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, backupVaultName, filter); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BackupsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = BackupsList.DeserializeBackupsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderAccountRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderAccountRestOperations.cs index c509516e5494..690e30bd9946 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderAccountRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderAccountRestOperations.cs @@ -6,125 +6,60 @@ #nullable disable using System; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class BackupsUnderAccountRestOperations + internal partial class BackupsUnderAccount { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of BackupsUnderAccountRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public BackupsUnderAccountRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of BackupsUnderAccount for mocking. + protected BackupsUnderAccount() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateMigrateBackupsRequestUri(string subscriptionId, string resourceGroupName, string accountName, BackupsMigrationContent content) + /// Initializes a new instance of BackupsUnderAccount. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal BackupsUnderAccount(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/migrateBackups", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateMigrateBackupsRequest(string subscriptionId, string resourceGroupName, string accountName, BackupsMigrationContent content) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateMigrateBackupsRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/migrateBackups", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - - /// Migrate the backups under a NetApp account to backup vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// Migrate backups under an account payload supplied in the body of the operation. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task MigrateBackupsAsync(string subscriptionId, string resourceGroupName, string accountName, BackupsMigrationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateMigrateBackupsRequest(subscriptionId, resourceGroupName, accountName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Migrate the backups under a NetApp account to backup vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// Migrate backups under an account payload supplied in the body of the operation. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response MigrateBackups(string subscriptionId, string resourceGroupName, string accountName, BackupsMigrationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateMigrateBackupsRequest(subscriptionId, resourceGroupName, accountName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderBackupVaultRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderBackupVaultRestOperations.cs index 859d3bd05461..bfcafc9b6256 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderBackupVaultRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderBackupVaultRestOperations.cs @@ -6,63 +6,47 @@ #nullable disable using System; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class BackupsUnderBackupVaultRestOperations + internal partial class BackupsUnderBackupVault { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of BackupsUnderBackupVaultRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public BackupsUnderBackupVaultRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of BackupsUnderBackupVault for mocking. + protected BackupsUnderBackupVault() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateRestoreFilesRequestUri(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppVolumeBackupBackupRestoreFilesContent content) + /// Initializes a new instance of BackupsUnderBackupVault. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal BackupsUnderBackupVault(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/backupVaults/", false); - uri.AppendPath(backupVaultName, true); - uri.AppendPath("/backups/", false); - uri.AppendPath(backupName, true); - uri.AppendPath("/restoreFiles", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateRestoreFilesRequest(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppVolumeBackupBackupRestoreFilesContent content) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateRestoreFilesRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -73,74 +57,13 @@ internal HttpMessage CreateRestoreFilesRequest(string subscriptionId, string res uri.AppendPath(backupName, true); uri.AppendPath("/restoreFiles", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - - /// Restore the specified files from the specified backup to the active filesystem. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The name of the backup. - /// Restore payload supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task RestoreFilesAsync(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppVolumeBackupBackupRestoreFilesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateRestoreFilesRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, backupName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Restore the specified files from the specified backup to the active filesystem. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Backup Vault. - /// The name of the backup. - /// Restore payload supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response RestoreFiles(string subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, NetAppVolumeBackupBackupRestoreFilesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(backupVaultName, nameof(backupVaultName)); - Argument.AssertNotNullOrEmpty(backupName, nameof(backupName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateRestoreFilesRequest(subscriptionId, resourceGroupName, accountName, backupVaultName, backupName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderVolumeRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderVolumeRestOperations.cs index 191b35942b2c..ad62827d6989 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderVolumeRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BackupsUnderVolumeRestOperations.cs @@ -6,63 +6,47 @@ #nullable disable using System; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class BackupsUnderVolumeRestOperations + internal partial class BackupsUnderVolume { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of BackupsUnderVolumeRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public BackupsUnderVolumeRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of BackupsUnderVolume for mocking. + protected BackupsUnderVolume() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateMigrateBackupsRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, BackupsMigrationContent content) + /// Initializes a new instance of BackupsUnderVolume. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal BackupsUnderVolume(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/migrateBackups", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateMigrateBackupsRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, BackupsMigrationContent content) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateMigrateBackupsRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -73,74 +57,13 @@ internal HttpMessage CreateMigrateBackupsRequest(string subscriptionId, string r uri.AppendPath(volumeName, true); uri.AppendPath("/migrateBackups", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - - /// Migrate the backups under volume to backup vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Migrate backups under volume payload supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task MigrateBackupsAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, BackupsMigrationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateMigrateBackupsRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Migrate the backups under volume to backup vault. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Migrate backups under volume payload supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response MigrateBackups(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, BackupsMigrationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateMigrateBackupsRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BucketsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BucketsRestOperations.cs index e7946b672a5c..cea9767df662 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BucketsRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/BucketsRestOperations.cs @@ -6,175 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class BucketsRestOperations + internal partial class Buckets { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of BucketsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public BucketsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of Buckets for mocking. + protected Buckets() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/buckets", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/buckets", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Describes all buckets belonging to a volume. Buckets allow additional services, such as AI services, connect to the volume data contained in those buckets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) + /// Initializes a new instance of Buckets. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal Buckets(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppBucketList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppBucketList.DeserializeNetAppBucketList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// Describes all buckets belonging to a volume. Buckets allow additional services, such as AI services, connect to the volume data contained in those buckets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppBucketList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppBucketList.DeserializeNetAppBucketList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/buckets/", false); - uri.AppendPath(bucketName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -186,115 +58,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/buckets/", false); uri.AppendPath(bucketName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the bucket. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, bucketName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppBucketData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppBucketData.DeserializeNetAppBucketData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppBucketData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the bucket. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, bucketName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppBucketData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppBucketData.DeserializeNetAppBucketData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppBucketData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/buckets/", false); - uri.AppendPath(bucketName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketData data) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -306,111 +83,22 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/buckets/", false); uri.AppendPath(bucketName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Creates or updates a bucket for a volume. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the bucket. - /// The bucket details including user details, and the volume path that should be mounted inside the bucket. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, bucketName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Creates or updates a bucket for a volume. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the bucket. - /// The bucket details including user details, and the volume path that should be mounted inside the bucket. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, bucketName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketPatch patch) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/buckets/", false); - uri.AppendPath(bucketName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -422,88 +110,22 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath("/buckets/", false); uri.AppendPath(bucketName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Updates the details of a volume bucket. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the bucket. - /// The bucket details including user details, and the volume path that should be mounted inside the bucket. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, bucketName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Updates the details of a volume bucket. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the bucket. - /// The bucket details including user details, and the volume path that should be mounted inside the bucket. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketPatch patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, bucketName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -515,18 +137,19 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/buckets/", false); uri.AppendPath(bucketName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -535,107 +158,34 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/buckets/", false); - uri.AppendPath(bucketName, true); + uri.AppendPath("/buckets", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Delete a volume's bucket. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the bucket. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, bucketName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a volume's bucket. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the bucket. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, bucketName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGenerateCredentialsRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketCredentialsExpiry body) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/buckets/", false); - uri.AppendPath(bucketName, true); - uri.AppendPath("/generateCredentials", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateGenerateCredentialsRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketCredentialsExpiry body) + internal HttpMessage CreateGenerateCredentialsRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -648,180 +198,14 @@ internal HttpMessage CreateGenerateCredentialsRequest(string subscriptionId, str uri.AppendPath(bucketName, true); uri.AppendPath("/generateCredentials", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(body, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Generate the access key and secret key used for accessing the specified volume bucket. Also return expiry date and time of key pair (in UTC). - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the bucket. - /// The bucket's Access and Secret key pair expiry time expressed as the number of days from now. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task> GenerateCredentialsAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketCredentialsExpiry body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - Argument.AssertNotNull(body, nameof(body)); - - using var message = CreateGenerateCredentialsRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, bucketName, body); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppBucketGenerateCredentials value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppBucketGenerateCredentials.DeserializeNetAppBucketGenerateCredentials(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Generate the access key and secret key used for accessing the specified volume bucket. Also return expiry date and time of key pair (in UTC). - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the bucket. - /// The bucket's Access and Secret key pair expiry time expressed as the number of days from now. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response GenerateCredentials(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string bucketName, NetAppBucketCredentialsExpiry body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); - Argument.AssertNotNull(body, nameof(body)); - - using var message = CreateGenerateCredentialsRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, bucketName, body); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppBucketGenerateCredentials value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppBucketGenerateCredentials.DeserializeNetAppBucketGenerateCredentials(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); return message; } - - /// Describes all buckets belonging to a volume. Buckets allow additional services, such as AI services, connect to the volume data contained in those buckets. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppBucketList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppBucketList.DeserializeNetAppBucketList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Describes all buckets belonging to a volume. Buckets allow additional services, such as AI services, connect to the volume data contained in those buckets. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppBucketList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppBucketList.DeserializeNetAppBucketList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/CachesRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/CachesRestOperations.cs new file mode 100644 index 000000000000..c6ea595ccb15 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/CachesRestOperations.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class Caches + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of Caches for mocking. + protected Caches() + { + } + + /// Initializes a new instance of Caches. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal Caches(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string cacheName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/caches/", false); + uri.AppendPath(cacheName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string cacheName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/caches/", false); + uri.AppendPath(cacheName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string cacheName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/caches/", false); + uri.AppendPath(cacheName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string cacheName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/caches/", false); + uri.AppendPath(cacheName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByCapacityPoolsRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/caches", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetByCapacityPoolsRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetPeeringPassphrasesRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string cacheName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/caches/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/listPeeringPassphrases", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreatePoolChangeRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string cacheName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/caches/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/poolChange", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticAccountsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticAccountsRestOperations.cs new file mode 100644 index 000000000000..14b7a73c67b3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticAccountsRestOperations.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticAccounts + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ElasticAccounts for mocking. + protected ElasticAccounts() + { + } + + /// Initializes a new instance of ElasticAccounts. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ElasticAccounts(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByResourceGroupRequest(Guid subscriptionId, string resourceGroupName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetByResourceGroupRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetBySubscriptionRequest(Guid subscriptionId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetBySubscriptionRequest(Uri nextPage, Guid subscriptionId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupPoliciesRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupPoliciesRestOperations.cs new file mode 100644 index 000000000000..cc32dc2eac94 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupPoliciesRestOperations.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticBackupPolicies + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ElasticBackupPolicies for mocking. + protected ElasticBackupPolicies() + { + } + + /// Initializes a new instance of ElasticBackupPolicies. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ElasticBackupPolicies(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupPolicies/", false); + uri.AppendPath(backupPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupPolicies/", false); + uri.AppendPath(backupPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupPolicies/", false); + uri.AppendPath(backupPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupPolicyName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupPolicies/", false); + uri.AppendPath(backupPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByElasticAccountRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetByElasticAccountRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupVaultsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupVaultsRestOperations.cs new file mode 100644 index 000000000000..04f6f7e07bb8 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupVaultsRestOperations.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticBackupVaults + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ElasticBackupVaults for mocking. + protected ElasticBackupVaults() + { + } + + /// Initializes a new instance of ElasticBackupVaults. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ElasticBackupVaults(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupVaults/", false); + uri.AppendPath(backupVaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupVaults/", false); + uri.AppendPath(backupVaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupVaults/", false); + uri.AppendPath(backupVaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupVaults/", false); + uri.AppendPath(backupVaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByElasticAccountRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupVaults", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetByElasticAccountRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupsRestOperations.cs new file mode 100644 index 000000000000..3832fadc9be9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticBackupsRestOperations.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticBackups + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ElasticBackups for mocking. + protected ElasticBackups() + { + } + + /// Initializes a new instance of ElasticBackups. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ElasticBackups(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupVaults/", false); + uri.AppendPath(backupVaultName, true); + uri.AppendPath("/backups/", false); + uri.AppendPath(backupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupVaults/", false); + uri.AppendPath(backupVaultName, true); + uri.AppendPath("/backups/", false); + uri.AppendPath(backupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupVaults/", false); + uri.AppendPath(backupVaultName, true); + uri.AppendPath("/backups/", false); + uri.AppendPath(backupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, string backupName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupVaults/", false); + uri.AppendPath(backupVaultName, true); + uri.AppendPath("/backups/", false); + uri.AppendPath(backupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByVaultRequest(Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticBackupVaults/", false); + uri.AppendPath(backupVaultName, true); + uri.AppendPath("/backups", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetByVaultRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string backupVaultName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticCapacityPoolsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticCapacityPoolsRestOperations.cs new file mode 100644 index 000000000000..374b18374b6c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticCapacityPoolsRestOperations.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticCapacityPools + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ElasticCapacityPools for mocking. + protected ElasticCapacityPools() + { + } + + /// Initializes a new instance of ElasticCapacityPools. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ElasticCapacityPools(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByNetAppAccountRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetByNetAppAccountRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateChangeZoneRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/changeZone", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateCheckVolumeFilePathAvailabilityRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/checkVolumeFilePathAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticSnapshotPoliciesRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticSnapshotPoliciesRestOperations.cs new file mode 100644 index 000000000000..111930bdf510 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticSnapshotPoliciesRestOperations.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticSnapshotPolicies + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ElasticSnapshotPolicies for mocking. + protected ElasticSnapshotPolicies() + { + } + + /// Initializes a new instance of ElasticSnapshotPolicies. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ElasticSnapshotPolicies(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticSnapshotPolicies/", false); + uri.AppendPath(snapshotPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticSnapshotPolicies/", false); + uri.AppendPath(snapshotPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticSnapshotPolicies/", false); + uri.AppendPath(snapshotPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticSnapshotPolicies/", false); + uri.AppendPath(snapshotPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByElasticAccountRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticSnapshotPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetByElasticAccountRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetVolumesRequest(Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticSnapshotPolicies/", false); + uri.AppendPath(snapshotPolicyName, true); + uri.AppendPath("/elasticvolumes", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetVolumesRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticSnapshotsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticSnapshotsRestOperations.cs new file mode 100644 index 000000000000..d4e9b32c36c4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticSnapshotsRestOperations.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticSnapshots + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ElasticSnapshots for mocking. + protected ElasticSnapshots() + { + } + + /// Initializes a new instance of ElasticSnapshots. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ElasticSnapshots(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/elasticVolumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/elasticSnapshots/", false); + uri.AppendPath(snapshotName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/elasticVolumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/elasticSnapshots/", false); + uri.AppendPath(snapshotName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/elasticVolumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/elasticSnapshots/", false); + uri.AppendPath(snapshotName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByElasticVolumeRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/elasticVolumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/elasticSnapshots", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetByElasticVolumeRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticVolumesRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticVolumesRestOperations.cs new file mode 100644 index 000000000000..c61b87d50bdf --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/ElasticVolumesRestOperations.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class ElasticVolumes + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ElasticVolumes for mocking. + protected ElasticVolumes() + { + } + + /// Initializes a new instance of ElasticVolumes. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ElasticVolumes(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/elasticVolumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/elasticVolumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/elasticVolumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/elasticVolumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByElasticPoolRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/elasticVolumes", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetByElasticPoolRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateRevertRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/elasticAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/elasticCapacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/elasticVolumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/revert", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceQuotaLimitsAccountRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceQuotaLimitsAccountRestOperations.cs index de4f5a6db29f..0d842b0e9f79 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceQuotaLimitsAccountRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceQuotaLimitsAccountRestOperations.cs @@ -6,136 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class NetAppResourceQuotaLimitsAccountRestOperations + internal partial class NetAppResourceQuotaLimitsAccount { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of NetAppResourceQuotaLimitsAccountRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public NetAppResourceQuotaLimitsAccountRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName) + /// Initializes a new instance of NetAppResourceQuotaLimitsAccount for mocking. + protected NetAppResourceQuotaLimitsAccount() { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/quotaLimits", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/quotaLimits", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets a list of quota limits for all quotas that are under account. Currently PoolsPerAccount is the only one. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + /// Initializes a new instance of NetAppResourceQuotaLimitsAccount. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal NetAppResourceQuotaLimitsAccount(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - QuotaItemList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = QuotaItemList.DeserializeQuotaItemList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// Gets a list of quota limits for all quotas that are under account. Currently PoolsPerAccount is the only one. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - QuotaItemList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = QuotaItemList.DeserializeQuotaItemList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string quotaLimitName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string quotaLimitName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -143,175 +54,44 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath("/quotaLimits/", false); uri.AppendPath(quotaLimitName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string quotaLimitName) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendPath("/quotaLimits/", false); - uri.AppendPath(quotaLimitName, true); + uri.AppendPath("/quotaLimits", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get the default, current and usages account quota limit. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Quota Limit. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string quotaLimitName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, quotaLimitName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppSubscriptionQuotaItem value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the default, current and usages account quota limit. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the Quota Limit. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string quotaLimitName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, quotaLimitName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppSubscriptionQuotaItem value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// Gets a list of quota limits for all quotas that are under account. Currently PoolsPerAccount is the only one. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - QuotaItemList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = QuotaItemList.DeserializeQuotaItemList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of quota limits for all quotas that are under account. Currently PoolsPerAccount is the only one. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - QuotaItemList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = QuotaItemList.DeserializeQuotaItemList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceQuotaLimitsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceQuotaLimitsRestOperations.cs index 08e064732b16..368ec799cbcf 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceQuotaLimitsRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceQuotaLimitsRestOperations.cs @@ -6,286 +6,88 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class NetAppResourceQuotaLimitsRestOperations + internal partial class NetAppResourceQuotaLimits { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of NetAppResourceQuotaLimitsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public NetAppResourceQuotaLimitsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, AzureLocation location) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/quotaLimits", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, AzureLocation location) + /// Initializes a new instance of NetAppResourceQuotaLimits for mocking. + protected NetAppResourceQuotaLimits() { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/quotaLimits", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// Get the default and current limits for quotas. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + /// Initializes a new instance of NetAppResourceQuotaLimits. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal NetAppResourceQuotaLimits(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - QuotaItemList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = QuotaItemList.DeserializeQuotaItemList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// Get the default and current limits for quotas. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - QuotaItemList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = QuotaItemList.DeserializeQuotaItemList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, AzureLocation location, string quotaLimitName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, AzureLocation location, string quotaLimitName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); + uri.AppendPath(location.ToString(), true); uri.AppendPath("/quotaLimits/", false); uri.AppendPath(quotaLimitName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation location, string quotaLimitName) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, AzureLocation location, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/quotaLimits/", false); - uri.AppendPath(quotaLimitName, true); + uri.AppendPath(location.ToString(), true); + uri.AppendPath("/quotaLimits", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get the default and current subscription quota limit. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The name of the Quota Limit. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); - - using var message = CreateGetRequest(subscriptionId, location, quotaLimitName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppSubscriptionQuotaItem value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the default and current subscription quota limit. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The name of the Quota Limit. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, AzureLocation location, string quotaLimitName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, AzureLocation location, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(quotaLimitName, nameof(quotaLimitName)); - - using var message = CreateGetRequest(subscriptionId, location, quotaLimitName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppSubscriptionQuotaItem value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppSubscriptionQuotaItem.DeserializeNetAppSubscriptionQuotaItem(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, AzureLocation location) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// Get the default and current limits for quotas. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - QuotaItemList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = QuotaItemList.DeserializeQuotaItemList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the default and current limits for quotas. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - QuotaItemList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = QuotaItemList.DeserializeQuotaItemList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceRegionInfosRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceRegionInfosRestOperations.cs index eae2857f2694..8eb36ff02f59 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceRegionInfosRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceRegionInfosRestOperations.cs @@ -6,284 +6,87 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class NetAppResourceRegionInfosRestOperations + internal partial class NetAppResourceRegionInfos { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of NetAppResourceRegionInfosRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public NetAppResourceRegionInfosRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, AzureLocation location) + /// Initializes a new instance of NetAppResourceRegionInfos for mocking. + protected NetAppResourceRegionInfos() { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/regionInfos", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, AzureLocation location) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/regionInfos", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Provides region specific information. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + /// Initializes a new instance of NetAppResourceRegionInfos. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal NetAppResourceRegionInfos(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RegionInfosList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RegionInfosList.DeserializeRegionInfosList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// Provides region specific information. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RegionInfosList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RegionInfosList.DeserializeRegionInfosList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, AzureLocation location) + internal HttpMessage CreateGetRequest(Guid subscriptionId, AzureLocation location, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); + uri.AppendPath(location.ToString(), true); uri.AppendPath("/regionInfos/default", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation location) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, AzureLocation location, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/regionInfos/default", false); + uri.AppendPath(location.ToString(), true); + uri.AppendPath("/regionInfos", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Provides storage to network proximity and logical zone mapping information. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateGetRequest(subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RegionInfoResourceData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RegionInfoResourceData.DeserializeRegionInfoResourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RegionInfoResourceData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Provides storage to network proximity and logical zone mapping information. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, AzureLocation location, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateGetRequest(subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RegionInfoResourceData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RegionInfoResourceData.DeserializeRegionInfoResourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RegionInfoResourceData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, AzureLocation location) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// Provides region specific information. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RegionInfosList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RegionInfosList.DeserializeRegionInfosList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Provides region specific information. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RegionInfosList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RegionInfosList.DeserializeRegionInfosList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceRestOperations.cs index 60742e66bde1..aa1cea772b0b 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceRestOperations.cs @@ -6,570 +6,157 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class NetAppResourceRestOperations + internal partial class NetAppResource { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of NetAppResourceRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public NetAppResourceRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of NetAppResource for mocking. + protected NetAppResource() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(string subscriptionId, AzureLocation location, NetAppNameAvailabilityContent content) + /// Initializes a new instance of NetAppResource. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal NetAppResource(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/checkNameAvailability", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, AzureLocation location, NetAppNameAvailabilityContent content) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateCheckNameAvailabilityRequest(Guid subscriptionId, string location, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); uri.AppendPath(location, true); uri.AppendPath("/checkNameAvailability", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Check if a resource name is available. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// Name availability request. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> CheckNameAvailabilityAsync(string subscriptionId, AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckNameAvailabilityRequest(subscriptionId, location, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppCheckAvailabilityResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppCheckAvailabilityResult.DeserializeNetAppCheckAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Check if a resource name is available. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// Name availability request. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response CheckNameAvailability(string subscriptionId, AzureLocation location, NetAppNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckNameAvailabilityRequest(subscriptionId, location, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppCheckAvailabilityResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppCheckAvailabilityResult.DeserializeNetAppCheckAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCheckFilePathAvailabilityRequestUri(string subscriptionId, AzureLocation location, NetAppFilePathAvailabilityContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/checkFilePathAvailability", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCheckFilePathAvailabilityRequest(string subscriptionId, AzureLocation location, NetAppFilePathAvailabilityContent content) + internal HttpMessage CreateCheckFilePathAvailabilityRequest(Guid subscriptionId, string location, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); uri.AppendPath(location, true); uri.AppendPath("/checkFilePathAvailability", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Check if a file path is available. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// File path availability request. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> CheckFilePathAvailabilityAsync(string subscriptionId, AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckFilePathAvailabilityRequest(subscriptionId, location, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppCheckAvailabilityResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppCheckAvailabilityResult.DeserializeNetAppCheckAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Check if a file path is available. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// File path availability request. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response CheckFilePathAvailability(string subscriptionId, AzureLocation location, NetAppFilePathAvailabilityContent content, CancellationToken cancellationToken = default) + internal HttpMessage CreateCheckQuotaAvailabilityRequest(Guid subscriptionId, string location, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckFilePathAvailabilityRequest(subscriptionId, location, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppCheckAvailabilityResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppCheckAvailabilityResult.DeserializeNetAppCheckAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCheckQuotaAvailabilityRequestUri(string subscriptionId, AzureLocation location, NetAppQuotaAvailabilityContent content) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/checkQuotaAvailability", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCheckQuotaAvailabilityRequest(string subscriptionId, AzureLocation location, NetAppQuotaAvailabilityContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); uri.AppendPath(location, true); uri.AppendPath("/checkQuotaAvailability", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Check if a quota is available. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// Quota availability request. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> CheckQuotaAvailabilityAsync(string subscriptionId, AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckQuotaAvailabilityRequest(subscriptionId, location, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppCheckAvailabilityResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppCheckAvailabilityResult.DeserializeNetAppCheckAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Check if a quota is available. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// Quota availability request. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response CheckQuotaAvailability(string subscriptionId, AzureLocation location, NetAppQuotaAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckQuotaAvailabilityRequest(subscriptionId, location, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppCheckAvailabilityResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppCheckAvailabilityResult.DeserializeNetAppCheckAvailabilityResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateQueryRegionInfoRequestUri(string subscriptionId, AzureLocation location) + internal HttpMessage CreateQueryRegionInfoRequest(Guid subscriptionId, string location, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/regionInfo", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateQueryRegionInfoRequest(string subscriptionId, AzureLocation location) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); uri.AppendPath(location, true); uri.AppendPath("/regionInfo", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Provides storage to network proximity and logical zone mapping information. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> QueryRegionInfoAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateQueryRegionInfoRequest(subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppRegionInfo value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppRegionInfo.DeserializeNetAppRegionInfo(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Provides storage to network proximity and logical zone mapping information. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response QueryRegionInfo(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + internal HttpMessage CreateQueryNetworkSiblingSetRequest(Guid subscriptionId, string location, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateQueryRegionInfoRequest(subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppRegionInfo value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppRegionInfo.DeserializeNetAppRegionInfo(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateQueryNetworkSiblingSetRequestUri(string subscriptionId, AzureLocation location, QueryNetworkSiblingSetContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/queryNetworkSiblingSet", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateQueryNetworkSiblingSetRequest(string subscriptionId, AzureLocation location, QueryNetworkSiblingSetContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); uri.AppendPath(location, true); uri.AppendPath("/queryNetworkSiblingSet", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Get details of the specified network sibling set. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// Network sibling set to query. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> QueryNetworkSiblingSetAsync(string subscriptionId, AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateQueryNetworkSiblingSetRequest(subscriptionId, location, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetworkSiblingSet value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetworkSiblingSet.DeserializeNetworkSiblingSet(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get details of the specified network sibling set. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// Network sibling set to query. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response QueryNetworkSiblingSet(string subscriptionId, AzureLocation location, QueryNetworkSiblingSetContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateQueryNetworkSiblingSetRequest(subscriptionId, location, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetworkSiblingSet value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetworkSiblingSet.DeserializeNetworkSiblingSet(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateNetworkSiblingSetRequestUri(string subscriptionId, AzureLocation location, UpdateNetworkSiblingSetContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/updateNetworkSiblingSet", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateNetworkSiblingSetRequest(string subscriptionId, AzureLocation location, UpdateNetworkSiblingSetContent content) + internal HttpMessage CreateUpdateNetworkSiblingSetRequest(Guid subscriptionId, string location, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); uri.AppendPath(location, true); uri.AppendPath("/updateNetworkSiblingSet", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - - /// Update the network features of the specified network sibling set. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// Update for the specified network sibling set. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task UpdateNetworkSiblingSetAsync(string subscriptionId, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateUpdateNetworkSiblingSetRequest(subscriptionId, location, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update the network features of the specified network sibling set. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// Update for the specified network sibling set. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response UpdateNetworkSiblingSet(string subscriptionId, AzureLocation location, UpdateNetworkSiblingSetContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateUpdateNetworkSiblingSetRequest(subscriptionId, location, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceUsagesRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceUsagesRestOperations.cs index 1a006575bc0a..107eaf028392 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceUsagesRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/NetAppResourceUsagesRestOperations.cs @@ -6,286 +6,88 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class NetAppResourceUsagesRestOperations + internal partial class NetAppResourceUsages { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of NetAppResourceUsagesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public NetAppResourceUsagesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of NetAppResourceUsages for mocking. + protected NetAppResourceUsages() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, AzureLocation location) + /// Initializes a new instance of NetAppResourceUsages. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal NetAppResourceUsages(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/usages", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateListRequest(string subscriptionId, AzureLocation location) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string location, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); uri.AppendPath(location, true); uri.AppendPath("/usages", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get current subscription usages. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string location, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - UsagesListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = UsagesListResult.DeserializeUsagesListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get current subscription usages. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - UsagesListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = UsagesListResult.DeserializeUsagesListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, AzureLocation location, string usageType) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/usages/", false); - uri.AppendPath(usageType, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation location, string usageType) + internal HttpMessage CreateGetRequest(Guid subscriptionId, AzureLocation location, string usageType, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/providers/Microsoft.NetApp/locations/", false); - uri.AppendPath(location, true); + uri.AppendPath(location.ToString(), true); uri.AppendPath("/usages/", false); uri.AppendPath(usageType, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get current subscription usage of the specific type. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The type of usage. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, AzureLocation location, string usageType, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(usageType, nameof(usageType)); - - using var message = CreateGetRequest(subscriptionId, location, usageType); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppUsageResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppUsageResult.DeserializeNetAppUsageResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get current subscription usage of the specific type. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The type of usage. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, AzureLocation location, string usageType, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(usageType, nameof(usageType)); - - using var message = CreateGetRequest(subscriptionId, location, usageType); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppUsageResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppUsageResult.DeserializeNetAppUsageResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, AzureLocation location) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// Get current subscription usages. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - UsagesListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = UsagesListResult.DeserializeUsagesListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get current subscription usages. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the Azure region. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - UsagesListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = UsagesListResult.DeserializeUsagesListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/OperationsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/OperationsRestOperations.cs new file mode 100644 index 000000000000..eaf93ff4b066 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/OperationsRestOperations.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class Operations + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of Operations for mocking. + protected Operations() + { + } + + /// Initializes a new instance of Operations. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal Operations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetAllRequest(RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.NetApp/operations", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/PoolsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/PoolsRestOperations.cs index ef2f3f72eabe..361549265a36 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/PoolsRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/PoolsRestOperations.cs @@ -6,155 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class PoolsRestOperations + internal partial class Pools { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of PoolsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public PoolsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName) + /// Initializes a new instance of Pools for mocking. + protected Pools() { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// List all capacity pools in the NetApp Account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + /// Initializes a new instance of Pools. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal Pools(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CapacityPoolList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = CapacityPoolList.DeserializeCapacityPoolList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List all capacity pools in the NetApp Account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CapacityPoolList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = CapacityPoolList.DeserializeCapacityPoolList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -162,103 +54,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/capacityPools/", false); uri.AppendPath(poolName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get details of the specified capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CapacityPoolData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = CapacityPoolData.DeserializeCapacityPoolData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((CapacityPoolData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get details of the specified capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string poolName, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CapacityPoolData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = CapacityPoolData.DeserializeCapacityPoolData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((CapacityPoolData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, CapacityPoolData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, CapacityPoolData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -266,99 +75,22 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/capacityPools/", false); uri.AppendPath(poolName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or Update a capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// Capacity pool object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, CapacityPoolData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or Update a capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// Capacity pool object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string accountName, string poolName, CapacityPoolData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, CapacityPoolPatch patch) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, CapacityPoolPatch patch) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -366,80 +98,22 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath("/capacityPools/", false); uri.AppendPath(poolName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Patch the specified capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// Capacity pool object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, CapacityPoolPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Patch the specified capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// Capacity pool object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string accountName, string poolName, CapacityPoolPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -447,167 +121,43 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/capacityPools/", false); uri.AppendPath(poolName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); + uri.AppendPath("/capacityPools", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Delete the specified capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete the specified capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string poolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List all capacity pools in the NetApp Account. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CapacityPoolList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = CapacityPoolList.DeserializeCapacityPoolList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List all capacity pools in the NetApp Account. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CapacityPoolList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = CapacityPoolList.DeserializeCapacityPoolList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/RansomwareReportsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/RansomwareReportsRestOperations.cs new file mode 100644 index 000000000000..59a1f69916ff --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/RansomwareReportsRestOperations.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class RansomwareReports + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of RansomwareReports for mocking. + protected RansomwareReports() + { + } + + /// Initializes a new instance of RansomwareReports. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal RansomwareReports(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string ransomwareReportName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/volumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/ransomwareReports/", false); + uri.AppendPath(ransomwareReportName, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/volumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/ransomwareReports", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateClearSuspectsRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string ransomwareReportName, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/volumes/", false); + uri.AppendPath(volumeName, true); + uri.AppendPath("/ransomwareReports/", false); + uri.AppendPath(ransomwareReportName, true); + uri.AppendPath("/clearSuspects", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SnapshotPoliciesRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SnapshotPoliciesRestOperations.cs index 37fd378dac05..36bdadb7558e 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SnapshotPoliciesRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SnapshotPoliciesRestOperations.cs @@ -6,155 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class SnapshotPoliciesRestOperations + internal partial class SnapshotPolicies { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of SnapshotPoliciesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public SnapshotPoliciesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of SnapshotPolicies for mocking. + protected SnapshotPolicies() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/snapshotPolicies", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/snapshotPolicies", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// List snapshot policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + /// Initializes a new instance of SnapshotPolicies. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal SnapshotPolicies(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SnapshotPoliciesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SnapshotPoliciesList.DeserializeSnapshotPoliciesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List snapshot policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SnapshotPoliciesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SnapshotPoliciesList.DeserializeSnapshotPoliciesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/snapshotPolicies/", false); - uri.AppendPath(snapshotPolicyName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -162,103 +54,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/snapshotPolicies/", false); uri.AppendPath(snapshotPolicyName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get a snapshot Policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the snapshot policy. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, snapshotPolicyName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SnapshotPolicyData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SnapshotPolicyData.DeserializeSnapshotPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((SnapshotPolicyData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a snapshot Policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the snapshot policy. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, snapshotPolicyName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SnapshotPolicyData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SnapshotPolicyData.DeserializeSnapshotPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((SnapshotPolicyData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, SnapshotPolicyData data) + internal HttpMessage CreateCreateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/snapshotPolicies/", false); - uri.AppendPath(snapshotPolicyName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, SnapshotPolicyData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -266,109 +75,22 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendPath("/snapshotPolicies/", false); uri.AppendPath(snapshotPolicyName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create a snapshot policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the snapshot policy. - /// Snapshot policy object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> CreateAsync(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, SnapshotPolicyData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, snapshotPolicyName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - SnapshotPolicyData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SnapshotPolicyData.DeserializeSnapshotPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a snapshot policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the snapshot policy. - /// Snapshot policy object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, SnapshotPolicyData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, snapshotPolicyName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - SnapshotPolicyData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SnapshotPolicyData.DeserializeSnapshotPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, SnapshotPolicyPatch patch) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/snapshotPolicies/", false); - uri.AppendPath(snapshotPolicyName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, SnapshotPolicyPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -376,80 +98,22 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath("/snapshotPolicies/", false); uri.AppendPath(snapshotPolicyName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Patch a snapshot policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the snapshot policy. - /// Snapshot policy object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, SnapshotPolicyPatch patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, snapshotPolicyName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Patch a snapshot policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the snapshot policy. - /// Snapshot policy object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, SnapshotPolicyPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, snapshotPolicyName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -457,113 +121,51 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/snapshotPolicies/", false); uri.AppendPath(snapshotPolicyName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendPath("/snapshotPolicies/", false); - uri.AppendPath(snapshotPolicyName, true); + uri.AppendPath("/snapshotPolicies", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Delete snapshot policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the snapshot policy. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, snapshotPolicyName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete snapshot policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the snapshot policy. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, snapshotPolicyName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListVolumesRequestUri(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/snapshotPolicies/", false); - uri.AppendPath(snapshotPolicyName, true); - uri.AppendPath("/volumes", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateListVolumesRequest(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName) + internal HttpMessage CreateGetVolumesRequest(Guid subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -572,72 +174,12 @@ internal HttpMessage CreateListVolumesRequest(string subscriptionId, string reso uri.AppendPath(snapshotPolicyName, true); uri.AppendPath("/volumes", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// Get volumes associated with snapshot policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the snapshot policy. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListVolumesAsync(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - - using var message = CreateListVolumesRequest(subscriptionId, resourceGroupName, accountName, snapshotPolicyName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SnapshotPolicyVolumeList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SnapshotPolicyVolumeList.DeserializeSnapshotPolicyVolumeList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get volumes associated with snapshot policy. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the snapshot policy. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListVolumes(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - - using var message = CreateListVolumesRequest(subscriptionId, resourceGroupName, accountName, snapshotPolicyName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SnapshotPolicyVolumeList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SnapshotPolicyVolumeList.DeserializeSnapshotPolicyVolumeList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SnapshotsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SnapshotsRestOperations.cs index 782d2abc3ac0..915b3c6351d7 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SnapshotsRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SnapshotsRestOperations.cs @@ -6,175 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class SnapshotsRestOperations + internal partial class Snapshots { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of SnapshotsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public SnapshotsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + /// Initializes a new instance of Snapshots for mocking. + protected Snapshots() { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/snapshots", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/snapshots", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List all snapshots associated with the volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) + /// Initializes a new instance of Snapshots. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal Snapshots(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SnapshotsList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SnapshotsList.DeserializeSnapshotsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List all snapshots associated with the volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SnapshotsList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SnapshotsList.DeserializeSnapshotsList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/snapshots/", false); - uri.AppendPath(snapshotName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -186,92 +58,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/snapshots/", false); uri.AppendPath(snapshotName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get details of the specified snapshot. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the snapshot. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, snapshotName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeSnapshotData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppVolumeSnapshotData.DeserializeNetAppVolumeSnapshotData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppVolumeSnapshotData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get details of the specified snapshot. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the snapshot. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, snapshotName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeSnapshotData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppVolumeSnapshotData.DeserializeNetAppVolumeSnapshotData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppVolumeSnapshotData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, NetAppVolumeSnapshotData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -283,18 +83,22 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string uri.AppendPath("/snapshots/", false); uri.AppendPath(snapshotName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, NetAppVolumeSnapshotData data) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -306,88 +110,22 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendPath("/snapshots/", false); uri.AppendPath(snapshotName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create the specified snapshot within the given volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the snapshot. - /// Snapshot object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, NetAppVolumeSnapshotData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, snapshotName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 201: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create the specified snapshot within the given volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the snapshot. - /// Snapshot object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, NetAppVolumeSnapshotData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, snapshotName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 201: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -399,18 +137,19 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/snapshots/", false); uri.AppendPath(snapshotName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -419,109 +158,34 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/snapshots/", false); - uri.AppendPath(snapshotName, true); + uri.AppendPath("/snapshots", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Delete snapshot. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the snapshot. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, snapshotName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete snapshot. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the snapshot. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, snapshotName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRestoreFilesRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, NetAppVolumeSnapshotRestoreFilesContent content) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/snapshots/", false); - uri.AppendPath(snapshotName, true); - uri.AppendPath("/restoreFiles", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateRestoreFilesRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, NetAppVolumeSnapshotRestoreFilesContent content) + internal HttpMessage CreateRestoreFilesRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -534,80 +198,13 @@ internal HttpMessage CreateRestoreFilesRequest(string subscriptionId, string res uri.AppendPath(snapshotName, true); uri.AppendPath("/restoreFiles", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - - /// Restore the specified files from the specified snapshot to the active filesystem. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the snapshot. - /// Restore payload supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task RestoreFilesAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, NetAppVolumeSnapshotRestoreFilesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateRestoreFilesRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, snapshotName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Restore the specified files from the specified snapshot to the active filesystem. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the snapshot. - /// Restore payload supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response RestoreFiles(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName, NetAppVolumeSnapshotRestoreFilesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateRestoreFilesRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, snapshotName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SubvolumesRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SubvolumesRestOperations.cs index dbc97f031fc5..075b0a258dfa 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SubvolumesRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/SubvolumesRestOperations.cs @@ -6,175 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class SubvolumesRestOperations + internal partial class Subvolumes { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of SubvolumesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public SubvolumesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of Subvolumes for mocking. + protected Subvolumes() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByVolumeRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/subvolumes", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByVolumeRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/subvolumes", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Returns a list of the subvolumes in the volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListByVolumeAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) + /// Initializes a new instance of Subvolumes. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal Subvolumes(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListByVolumeRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SubvolumesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SubvolumesList.DeserializeSubvolumesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// Returns a list of the subvolumes in the volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ListByVolume(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListByVolumeRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SubvolumesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SubvolumesList.DeserializeSubvolumesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/subvolumes/", false); - uri.AppendPath(subvolumeName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -186,115 +58,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/subvolumes/", false); uri.AppendPath(subvolumeName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Returns the path associated with the subvolumeName provided. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the subvolume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, subvolumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppSubvolumeInfoData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppSubvolumeInfoData.DeserializeNetAppSubvolumeInfoData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppSubvolumeInfoData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Returns the path associated with the subvolumeName provided. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the subvolume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, subvolumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppSubvolumeInfoData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppSubvolumeInfoData.DeserializeNetAppSubvolumeInfoData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppSubvolumeInfoData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, NetAppSubvolumeInfoData info) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/subvolumes/", false); - uri.AppendPath(subvolumeName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, NetAppSubvolumeInfoData info) + internal HttpMessage CreateCreateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -306,113 +83,22 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendPath("/subvolumes/", false); uri.AppendPath(subvolumeName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(info, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Creates a subvolume in the path or clones the subvolume mentioned in the parentPath. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the subvolume. - /// Subvolume object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, NetAppSubvolumeInfoData info, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - Argument.AssertNotNull(info, nameof(info)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, subvolumeName, info); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Creates a subvolume in the path or clones the subvolume mentioned in the parentPath. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the subvolume. - /// Subvolume object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, NetAppSubvolumeInfoData info, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - Argument.AssertNotNull(info, nameof(info)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, subvolumeName, info); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, NetAppSubvolumeInfoPatch patch) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/subvolumes/", false); - uri.AppendPath(subvolumeName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, NetAppSubvolumeInfoPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -424,88 +110,22 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath("/subvolumes/", false); uri.AppendPath(subvolumeName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Patch a subvolume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the subvolume. - /// Subvolume object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, NetAppSubvolumeInfoPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, subvolumeName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Patch a subvolume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the subvolume. - /// Subvolume object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, NetAppSubvolumeInfoPatch patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, subvolumeName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -517,18 +137,19 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/subvolumes/", false); uri.AppendPath(subvolumeName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName) + internal HttpMessage CreateGetByVolumeRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -537,109 +158,34 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/subvolumes/", false); - uri.AppendPath(subvolumeName, true); + uri.AppendPath("/subvolumes", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Delete subvolume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the subvolume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, subvolumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete subvolume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the subvolume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetByVolumeRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, subvolumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetMetadataRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/subvolumes/", false); - uri.AppendPath(subvolumeName, true); - uri.AppendPath("/getMetadata", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateGetMetadataRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName) + internal HttpMessage CreateGetMetadataRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -652,164 +198,12 @@ internal HttpMessage CreateGetMetadataRequest(string subscriptionId, string reso uri.AppendPath(subvolumeName, true); uri.AppendPath("/getMetadata", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get details of the specified subvolume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the subvolume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task GetMetadataAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var message = CreateGetMetadataRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, subvolumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get details of the specified subvolume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of the subvolume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response GetMetadata(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); - - using var message = CreateGetMetadataRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, subvolumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByVolumeNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByVolumeNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// Returns a list of the subvolumes in the volume. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListByVolumeNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListByVolumeNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SubvolumesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SubvolumesList.DeserializeSubvolumesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Returns a list of the subvolumes in the volume. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ListByVolumeNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListByVolumeNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SubvolumesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SubvolumesList.DeserializeSubvolumesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumeGroupsRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumeGroupsRestOperations.cs index a0841756eeda..515cdef29b5a 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumeGroupsRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumeGroupsRestOperations.cs @@ -6,155 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class VolumeGroupsRestOperations + internal partial class VolumeGroups { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of VolumeGroupsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public VolumeGroupsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListByNetAppAccountRequestUri(string subscriptionId, string resourceGroupName, string accountName) + /// Initializes a new instance of VolumeGroups for mocking. + protected VolumeGroups() { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/volumeGroups", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; } - internal HttpMessage CreateListByNetAppAccountRequest(string subscriptionId, string resourceGroupName, string accountName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/volumeGroups", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List all volume groups for given account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByNetAppAccountAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + /// Initializes a new instance of VolumeGroups. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal VolumeGroups(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - - using var message = CreateListByNetAppAccountRequest(subscriptionId, resourceGroupName, accountName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VolumeGroupList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VolumeGroupList.DeserializeVolumeGroupList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List all volume groups for given account. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByNetAppAccount(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListByNetAppAccountRequest(subscriptionId, resourceGroupName, accountName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VolumeGroupList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VolumeGroupList.DeserializeVolumeGroupList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/volumeGroups/", false); - uri.AppendPath(volumeGroupName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -162,103 +54,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/volumeGroups/", false); uri.AppendPath(volumeGroupName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get details of the specified volume group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the volumeGroup. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, volumeGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeGroupData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppVolumeGroupData.DeserializeNetAppVolumeGroupData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppVolumeGroupData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get details of the specified volume group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the volumeGroup. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, volumeGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeGroupData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppVolumeGroupData.DeserializeNetAppVolumeGroupData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppVolumeGroupData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, NetAppVolumeGroupData data) + internal HttpMessage CreateCreateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/volumeGroups/", false); - uri.AppendPath(volumeGroupName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, NetAppVolumeGroupData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -266,78 +75,22 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendPath("/volumeGroups/", false); uri.AppendPath(volumeGroupName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create a volume group along with specified volumes. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the volumeGroup. - /// Volume Group object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, NetAppVolumeGroupData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, volumeGroupName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a volume group along with specified volumes. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the volumeGroup. - /// Volume Group object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, NetAppVolumeGroupData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, volumeGroupName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -345,85 +98,43 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/volumeGroups/", false); uri.AppendPath(volumeGroupName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName) + internal HttpMessage CreateGetByNetAppAccountRequest(Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); - uri.AppendPath("/volumeGroups/", false); - uri.AppendPath(volumeGroupName, true); + uri.AppendPath("/volumeGroups", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Delete the specified volume group only if there are no volumes under volume group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the volumeGroup. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetByNetAppAccountRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, volumeGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete the specified volume group only if there are no volumes under volume group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the volumeGroup. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, volumeGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumeQuotaRulesRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumeQuotaRulesRestOperations.cs index 8feec21e1a98..66f3a1f68dca 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumeQuotaRulesRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumeQuotaRulesRestOperations.cs @@ -6,175 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class VolumeQuotaRulesRestOperations + internal partial class VolumeQuotaRules { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of VolumeQuotaRulesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public VolumeQuotaRulesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of VolumeQuotaRules for mocking. + protected VolumeQuotaRules() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListByVolumeRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/volumeQuotaRules", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByVolumeRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/volumeQuotaRules", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// List all quota rules associated with the volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListByVolumeAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) + /// Initializes a new instance of VolumeQuotaRules. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal VolumeQuotaRules(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListByVolumeRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VolumeQuotaRulesList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VolumeQuotaRulesList.DeserializeVolumeQuotaRulesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List all quota rules associated with the volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ListByVolume(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListByVolumeRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VolumeQuotaRulesList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VolumeQuotaRulesList.DeserializeVolumeQuotaRulesList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/volumeQuotaRules/", false); - uri.AppendPath(volumeQuotaRuleName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -186,115 +58,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/volumeQuotaRules/", false); uri.AppendPath(volumeQuotaRuleName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get details of the specified quota rule. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of volume quota rule. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeQuotaRuleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppVolumeQuotaRuleData.DeserializeNetAppVolumeQuotaRuleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppVolumeQuotaRuleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get details of the specified quota rule. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of volume quota rule. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeQuotaRuleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppVolumeQuotaRuleData.DeserializeNetAppVolumeQuotaRuleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppVolumeQuotaRuleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, NetAppVolumeQuotaRuleData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/volumeQuotaRules/", false); - uri.AppendPath(volumeQuotaRuleName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, NetAppVolumeQuotaRuleData data) + internal HttpMessage CreateCreateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -306,111 +83,22 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendPath("/volumeQuotaRules/", false); uri.AppendPath(volumeQuotaRuleName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create the specified quota rule within the given volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of volume quota rule. - /// Quota rule object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, NetAppVolumeQuotaRuleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create the specified quota rule within the given volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of volume quota rule. - /// Quota rule object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, NetAppVolumeQuotaRuleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, NetAppVolumeQuotaRulePatch patch) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/volumeQuotaRules/", false); - uri.AppendPath(volumeQuotaRuleName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, NetAppVolumeQuotaRulePatch patch) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -422,88 +110,22 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath("/volumeQuotaRules/", false); uri.AppendPath(volumeQuotaRuleName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Patch a quota rule. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of volume quota rule. - /// Quota rule object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, NetAppVolumeQuotaRulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Patch a quota rule. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of volume quota rule. - /// Quota rule object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, NetAppVolumeQuotaRulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -515,18 +137,19 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/volumeQuotaRules/", false); uri.AppendPath(volumeQuotaRuleName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + internal HttpMessage CreateGetByVolumeRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -535,77 +158,26 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/volumeQuotaRules/", false); - uri.AppendPath(volumeQuotaRuleName, true); + uri.AppendPath("/volumeQuotaRules", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Delete quota rule. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of volume quota rule. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetByVolumeRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete quota rule. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The name of volume quota rule. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, volumeQuotaRuleName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumesRestOperations.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumesRestOperations.cs index a51a992913fe..2a5fec62df79 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumesRestOperations.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/RestOperations/VolumesRestOperations.cs @@ -6,144 +6,95 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - internal partial class VolumesRestOperations + internal partial class Volumes { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of VolumesRestOperations. + /// Initializes a new instance of Volumes for mocking. + protected Volumes() + { + } + + /// Initializes a new instance of Volumes. + /// The ClientDiagnostics is used to provide tracing support for the client library. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public VolumesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Service endpoint. + /// + internal Volumes(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-07-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName) + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/capacityPools/", false); uri.AppendPath(poolName, true); - uri.AppendPath("/volumes", false); + uri.AppendPath("/volumes/", false); + uri.AppendPath(volumeName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/capacityPools/", false); uri.AppendPath(poolName, true); - uri.AppendPath("/volumes", false); + uri.AppendPath("/volumes/", false); + uri.AppendPath(volumeName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// List all volumes within the capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName, poolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VolumeList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VolumeList.DeserializeVolumeList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List all volumes within the capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string accountName, string poolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName, poolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VolumeList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VolumeList.DeserializeVolumeList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -153,18 +104,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, bool? forceDelete, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -174,88 +129,57 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); uri.AppendQuery("api-version", _apiVersion, true); + if (forceDelete != null) + { + uri.AppendQuery("forceDelete", TypeFormatters.ConvertToString(forceDelete), true); + } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Delete; return message; } - /// Get the details of the specified volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetAllRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppVolumeData.DeserializeNetAppVolumeData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppVolumeData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/capacityPools/", false); + uri.AppendPath(poolName, true); + uri.AppendPath("/volumes", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - /// Get the details of the specified volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppVolumeData.DeserializeNetAppVolumeData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((NetAppVolumeData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeData data) + internal HttpMessage CreatePopulateAvailabilityZoneRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -264,19 +188,22 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); + uri.AppendPath("/populateAvailabilityZone", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeData data) + internal HttpMessage CreateRevertRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -285,87 +212,23 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); + uri.AppendPath("/revert", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or update the specified volume within the capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Volume object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or update the specified volume within the capacity pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Volume object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumePatch patch) + internal HttpMessage CreateResetCifsPasswordRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -374,19 +237,21 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); + uri.AppendPath("/resetCifsPassword", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumePatch patch) + internal HttpMessage CreateSplitCloneFromParentRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -395,85 +260,22 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); + uri.AppendPath("/splitCloneFromParent", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Patch the specified volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Volume object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Patch the specified volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Volume object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, bool? forceDelete) + internal HttpMessage CreateBreakFileLocksRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -482,23 +284,26 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - if (forceDelete != null) + uri.AppendPath("/breakFileLocks", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + if ("application/json" != null) { - uri.AppendQuery("forceDelete", forceDelete.Value, true); + request.Headers.SetValue("Content-Type", "application/json"); } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + request.Content = content; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, bool? forceDelete) + internal HttpMessage CreateGetGetGroupIdListForLdapUserRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -507,83 +312,24 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - if (forceDelete != null) - { - uri.AppendQuery("forceDelete", forceDelete.Value, true); - } + uri.AppendPath("/getGroupIdListForLdapUser", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Delete the specified volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// An option to force delete the volume. Will cleanup resources connected to the particular volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, bool? forceDelete = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, forceDelete); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete the specified volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// An option to force delete the volume. Will cleanup resources connected to the particular volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, bool? forceDelete = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateBreakReplicationRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, forceDelete); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreatePopulateAvailabilityZoneRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -592,20 +338,26 @@ internal RequestUriBuilder CreatePopulateAvailabilityZoneRequestUri(string subsc uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/populateAvailabilityZone", false); + uri.AppendPath("/breakReplication", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + if ("application/json" != null) + { + request.Headers.SetValue("Content-Type", "application/json"); + } + request.Content = content; + return message; } - internal HttpMessage CreatePopulateAvailabilityZoneRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + internal HttpMessage CreateReestablishReplicationRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -614,78 +366,23 @@ internal HttpMessage CreatePopulateAvailabilityZoneRequest(string subscriptionId uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/populateAvailabilityZone", false); + uri.AppendPath("/reestablishReplication", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - /// This operation will populate availability zone information for a volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task PopulateAvailabilityZoneAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreatePopulateAvailabilityZoneRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// This operation will populate availability zone information for a volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response PopulateAvailabilityZone(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreatePopulateAvailabilityZoneRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRevertRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeRevertContent content) + internal HttpMessage CreateReplicationStatusRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -694,20 +391,22 @@ internal RequestUriBuilder CreateRevertRequestUri(string subscriptionId, string uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/revert", false); + uri.AppendPath("/replicationStatus", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateRevertRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeRevertContent content) + internal HttpMessage CreateGetReplicationsRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -716,86 +415,39 @@ internal HttpMessage CreateRevertRequest(string subscriptionId, string resourceG uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/revert", false); + uri.AppendPath("/listReplications", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Revert a volume to the snapshot specified in the body. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Object for snapshot to revert supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task RevertAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeRevertContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateRevertRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + request.Method = RequestMethod.Post; + if ("application/json" != null) { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); + request.Headers.SetValue("Content-Type", "application/json"); } + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - /// Revert a volume to the snapshot specified in the body. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Object for snapshot to revert supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Revert(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeRevertContent content, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetReplicationsRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateRevertRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateResetCifsPasswordRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + internal HttpMessage CreateResyncReplicationRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -804,20 +456,21 @@ internal RequestUriBuilder CreateResetCifsPasswordRequestUri(string subscription uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/resetCifsPassword", false); + uri.AppendPath("/resyncReplication", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; } - internal HttpMessage CreateResetCifsPasswordRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + internal HttpMessage CreateDeleteReplicationRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -826,76 +479,21 @@ internal HttpMessage CreateResetCifsPasswordRequest(string subscriptionId, strin uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/resetCifsPassword", false); + uri.AppendPath("/deleteReplication", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; return message; } - /// Reset cifs password from volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task ResetCifsPasswordAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateResetCifsPasswordRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Reset cifs password from volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ResetCifsPassword(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateResetCifsPasswordRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateSplitCloneFromParentRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + internal HttpMessage CreateAuthorizeReplicationRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -904,20 +502,23 @@ internal RequestUriBuilder CreateSplitCloneFromParentRequestUri(string subscript uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/splitCloneFromParent", false); + uri.AppendPath("/authorizeReplication", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateSplitCloneFromParentRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + internal HttpMessage CreateReInitializeReplicationRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -926,78 +527,21 @@ internal HttpMessage CreateSplitCloneFromParentRequest(string subscriptionId, st uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/splitCloneFromParent", false); + uri.AppendPath("/reinitializeReplication", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; return message; } - /// Split operation to convert clone volume to an independent volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task SplitCloneFromParentAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateSplitCloneFromParentRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Split operation to convert clone volume to an independent volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response SplitCloneFromParent(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateSplitCloneFromParentRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateBreakFileLocksRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeBreakFileLocksContent content) + internal HttpMessage CreatePeerExternalClusterRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -1006,20 +550,24 @@ internal RequestUriBuilder CreateBreakFileLocksRequestUri(string subscriptionId, uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/breakFileLocks", false); + uri.AppendPath("/peerExternalCluster", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateBreakFileLocksRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeBreakFileLocksContent content) + internal HttpMessage CreateAuthorizeExternalReplicationRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -1028,87 +576,22 @@ internal HttpMessage CreateBreakFileLocksRequest(string subscriptionId, string r uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/breakFileLocks", false); + uri.AppendPath("/authorizeExternalReplication", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (content != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - } - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Break all the file locks on a volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Optional body to provide the ability to clear file locks with selected options. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task BreakFileLocksAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeBreakFileLocksContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateBreakFileLocksRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Break all the file locks on a volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Optional body to provide the ability to clear file locks with selected options. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response BreakFileLocks(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeBreakFileLocksContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateBreakFileLocksRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListGetGroupIdListForLdapUserRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, GetGroupIdListForLdapUserContent content) + internal HttpMessage CreateFinalizeExternalReplicationRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -1117,20 +600,21 @@ internal RequestUriBuilder CreateListGetGroupIdListForLdapUserRequestUri(string uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/getGroupIdListForLdapUser", false); + uri.AppendPath("/finalizeExternalReplication", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; } - internal HttpMessage CreateListGetGroupIdListForLdapUserRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, GetGroupIdListForLdapUserContent content) + internal HttpMessage CreatePerformReplicationTransferRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -1139,1477 +623,21 @@ internal HttpMessage CreateListGetGroupIdListForLdapUserRequest(string subscript uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/getGroupIdListForLdapUser", false); + uri.AppendPath("/performReplicationTransfer", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; return message; } - /// Returns the list of group Ids for a specific LDAP User. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Returns group Id list for a specific LDAP user. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task ListGetGroupIdListForLdapUserAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, GetGroupIdListForLdapUserContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateListGetGroupIdListForLdapUserRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Returns the list of group Ids for a specific LDAP User. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Returns group Id list for a specific LDAP user. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ListGetGroupIdListForLdapUser(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, GetGroupIdListForLdapUserContent content, CancellationToken cancellationToken = default) + internal HttpMessage CreatePoolChangeRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateListGetGroupIdListForLdapUserRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListQuotaReportRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/listQuotaReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListQuotaReportRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/listQuotaReport", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Returns report of quotas for the volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task ListQuotaReportAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListQuotaReportRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Returns report of quotas for the volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ListQuotaReport(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListQuotaReportRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateBreakReplicationRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeBreakReplicationContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/breakReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateBreakReplicationRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeBreakReplicationContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/breakReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (content != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - } - _userAgent.Apply(message); - return message; - } - - /// Break the replication connection on the destination volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Optional body to force break the replication. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task BreakReplicationAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeBreakReplicationContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateBreakReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Break the replication connection on the destination volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Optional body to force break the replication. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response BreakReplication(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeBreakReplicationContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateBreakReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateReestablishReplicationRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeReestablishReplicationContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/reestablishReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateReestablishReplicationRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeReestablishReplicationContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/reestablishReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Re-establish a previously deleted replication between 2 volumes that have a common ad-hoc or policy-based snapshots. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// body for the id of the source volume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task ReestablishReplicationAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeReestablishReplicationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateReestablishReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Re-establish a previously deleted replication between 2 volumes that have a common ad-hoc or policy-based snapshots. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// body for the id of the source volume. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ReestablishReplication(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeReestablishReplicationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateReestablishReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateReplicationStatusRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/replicationStatus", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateReplicationStatusRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/replicationStatus", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get the status of the replication. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ReplicationStatusAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateReplicationStatusRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeReplicationStatus value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NetAppVolumeReplicationStatus.DeserializeNetAppVolumeReplicationStatus(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the status of the replication. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ReplicationStatus(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateReplicationStatusRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NetAppVolumeReplicationStatus value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NetAppVolumeReplicationStatus.DeserializeNetAppVolumeReplicationStatus(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListReplicationsRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/listReplications", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListReplicationsRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/listReplications", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List all replications for a specified volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListReplicationsAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListReplicationsRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ListReplications value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = Models.ListReplications.DeserializeListReplications(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List all replications for a specified volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ListReplications(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateListReplicationsRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ListReplications value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = Models.ListReplications.DeserializeListReplications(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateResyncReplicationRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/resyncReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateResyncReplicationRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/resyncReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from destination to source. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task ResyncReplicationAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateResyncReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from destination to source. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ResyncReplication(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateResyncReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteReplicationRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/deleteReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteReplicationRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/deleteReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete the replication connection on the destination volume, and send release to the source replication. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteReplicationAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateDeleteReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete the replication connection on the destination volume, and send release to the source replication. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response DeleteReplication(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateDeleteReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateAuthorizeReplicationRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeAuthorizeReplicationContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/authorizeReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateAuthorizeReplicationRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeAuthorizeReplicationContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/authorizeReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Authorize the replication connection on the source volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Authorize request object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task AuthorizeReplicationAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeAuthorizeReplicationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateAuthorizeReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Authorize the replication connection on the source volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Authorize request object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response AuthorizeReplication(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumeAuthorizeReplicationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateAuthorizeReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateReInitializeReplicationRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/reinitializeReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateReInitializeReplicationRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/reinitializeReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Re-Initializes the replication connection on the destination volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task ReInitializeReplicationAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateReInitializeReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Re-Initializes the replication connection on the destination volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ReInitializeReplication(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateReInitializeReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreatePeerExternalClusterRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, PeerClusterForVolumeMigrationContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/peerExternalCluster", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreatePeerExternalClusterRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, PeerClusterForVolumeMigrationContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/peerExternalCluster", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Starts peering the external cluster for this migration volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Cluster peer request object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task PeerExternalClusterAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, PeerClusterForVolumeMigrationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreatePeerExternalClusterRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Starts peering the external cluster for this migration volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Cluster peer request object supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response PeerExternalCluster(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, PeerClusterForVolumeMigrationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreatePeerExternalClusterRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateAuthorizeExternalReplicationRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/authorizeExternalReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateAuthorizeExternalReplicationRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/authorizeExternalReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Starts SVM peering and returns a command to be run on the external ONTAP to accept it. Once the SVM have been peered a SnapMirror will be created. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task AuthorizeExternalReplicationAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateAuthorizeExternalReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Starts SVM peering and returns a command to be run on the external ONTAP to accept it. Once the SVM have been peered a SnapMirror will be created. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response AuthorizeExternalReplication(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateAuthorizeExternalReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateFinalizeExternalReplicationRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/finalizeExternalReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateFinalizeExternalReplicationRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/finalizeExternalReplication", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Finalizes the migration of an external volume by releasing the replication and breaking the external cluster peering if no other migration is active. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task FinalizeExternalReplicationAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateFinalizeExternalReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Finalizes the migration of an external volume by releasing the replication and breaking the external cluster peering if no other migration is active. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response FinalizeExternalReplication(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateFinalizeExternalReplicationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreatePerformReplicationTransferRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/performReplicationTransfer", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreatePerformReplicationTransferRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/performReplicationTransfer", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Performs an adhoc replication transfer on a volume with volumeType Migration. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task PerformReplicationTransferAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreatePerformReplicationTransferRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Performs an adhoc replication transfer on a volume with volumeType Migration. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response PerformReplicationTransfer(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreatePerformReplicationTransferRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreatePoolChangeRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumePoolChangeContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/poolChange", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreatePoolChangeRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumePoolChangeContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -2620,106 +648,21 @@ internal HttpMessage CreatePoolChangeRequest(string subscriptionId, string resou uri.AppendPath(volumeName, true); uri.AppendPath("/poolChange", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - /// Moves volume to another pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Move volume to the pool supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task PoolChangeAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumePoolChangeContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreatePoolChangeRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Moves volume to another pool. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Move volume to the pool supplied in the body of the operation. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response PoolChange(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, NetAppVolumePoolChangeContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreatePoolChangeRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRelocateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RelocateVolumeContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/relocate", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateRelocateRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RelocateVolumeContent content) + internal HttpMessage CreateRelocateRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -2730,107 +673,24 @@ internal HttpMessage CreateRelocateRequest(string subscriptionId, string resourc uri.AppendPath(volumeName, true); uri.AppendPath("/relocate", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (content != null) + request.Method = RequestMethod.Post; + if ("application/json" != null) { - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; + request.Headers.SetValue("Content-Type", "application/json"); } - _userAgent.Apply(message); + request.Content = content; return message; } - /// Relocates volume to a new stamp. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Relocate volume request. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task RelocateAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RelocateVolumeContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateRelocateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Relocates volume to a new stamp. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// Relocate volume request. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Relocate(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RelocateVolumeContent content = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateRelocateRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateFinalizeRelocationRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); - uri.AppendPath(accountName, true); - uri.AppendPath("/capacityPools/", false); - uri.AppendPath(poolName, true); - uri.AppendPath("/volumes/", false); - uri.AppendPath(volumeName, true); - uri.AppendPath("/finalizeRelocation", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateFinalizeRelocationRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + internal HttpMessage CreateFinalizeRelocationRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -2841,76 +701,19 @@ internal HttpMessage CreateFinalizeRelocationRequest(string subscriptionId, stri uri.AppendPath(volumeName, true); uri.AppendPath("/finalizeRelocation", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; return message; } - /// Finalizes the relocation of the volume and cleans up the old volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task FinalizeRelocationAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateFinalizeRelocationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Finalizes the relocation of the volume and cleans up the old volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response FinalizeRelocation(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) + internal HttpMessage CreateRevertRelocationRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateFinalizeRelocationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRevertRelocationRequestUri(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -2921,18 +724,19 @@ internal RequestUriBuilder CreateRevertRelocationRequestUri(string subscriptionI uri.AppendPath(volumeName, true); uri.AppendPath("/revertRelocation", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; } - internal HttpMessage CreateRevertRelocationRequest(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + internal HttpMessage CreateGetQuotaReportRequest(Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.NetApp/netAppAccounts/", false); @@ -2941,158 +745,14 @@ internal HttpMessage CreateRevertRelocationRequest(string subscriptionId, string uri.AppendPath(poolName, true); uri.AppendPath("/volumes/", false); uri.AppendPath(volumeName, true); - uri.AppendPath("/revertRelocation", false); + uri.AppendPath("/listQuotaReport", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Reverts the volume relocation process, cleans up the new volume and starts using the former-existing volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task RevertRelocationAsync(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateRevertRelocationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Reverts the volume relocation process, cleans up the new volume and starts using the former-existing volume. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The name of the volume. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response RevertRelocation(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - - using var message = CreateRevertRelocationRequest(subscriptionId, resourceGroupName, accountName, poolName, volumeName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List all volumes within the capacity pool. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, poolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VolumeList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VolumeList.DeserializeVolumeList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List all volumes within the capacity pool. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the NetApp account. - /// The name of the capacity pool. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string poolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, poolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VolumeList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VolumeList.DeserializeVolumeList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotCollection.cs new file mode 100644 index 000000000000..e408048edb7b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotCollection.cs @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetSnapshots method from an instance of the parent resource. + /// + public partial class SnapshotCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _snapshotsClientDiagnostics; + private readonly Snapshots _snapshotsRestClient; + + /// Initializes a new instance of SnapshotCollection for mocking. + protected SnapshotCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SnapshotCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(SnapshotResource.ResourceType, out string snapshotApiVersion); + _snapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", SnapshotResource.ResourceType.Namespace, Diagnostics); + _snapshotsRestClient = new Snapshots(_snapshotsClientDiagnostics, Pipeline, Endpoint, snapshotApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != VolumeResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, VolumeResource.ResourceType), id); + } + } + + /// + /// Create the specified snapshot within the given volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the snapshot. + /// Snapshot object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string snapshotName, SnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, SnapshotData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new SnapshotOperationSource(Client), + _snapshotsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create the specified snapshot within the given volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the snapshot. + /// Snapshot object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string snapshotName, SnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, SnapshotData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new SnapshotOperationSource(Client), + _snapshotsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the snapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SnapshotData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the snapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SnapshotData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all snapshots associated with the volume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new SnapshotsGetAllAsyncCollectionResultOfT( + _snapshotsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new SnapshotResource(Client, data)); + } + + /// List all snapshots associated with the volume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new SnapshotsGetAllCollectionResultOfT( + _snapshotsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new SnapshotResource(Client, data)); + } + + /// + /// Get details of the specified snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the snapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SnapshotData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SnapshotData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the snapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SnapshotData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SnapshotData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the snapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SnapshotData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SnapshotData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the snapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, snapshotName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SnapshotData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SnapshotData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotData.Serialization.cs new file mode 100644 index 000000000000..d9ece3da2555 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotData.Serialization.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Snapshot of a Volume. + public partial class SnapshotData : ResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal SnapshotData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SnapshotData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + } + + /// The JSON reader. + /// The client options for reading and writing models. + SnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (SnapshotData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SnapshotData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSnapshotData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SnapshotData DeserializeSnapshotData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + SnapshotProperties properties = default; + string location = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SnapshotProperties.DeserializeSnapshotProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("location"u8)) + { + location = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SnapshotData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties, + location); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SnapshotData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (SnapshotData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSnapshotData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SnapshotData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(SnapshotData snapshotData) + { + if (snapshotData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(snapshotData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static SnapshotData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSnapshotData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotData.cs new file mode 100644 index 000000000000..2d0129eb4a3b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotData.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Snapshot of a Volume. + public partial class SnapshotData : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Resource location. + /// is null. + public SnapshotData(string location) + { + + Location = location; + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Snapshot Properties. + /// Resource location. + internal SnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, SnapshotProperties properties, string location) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + Location = location; + } + + /// Snapshot Properties. + internal SnapshotProperties Properties { get; set; } + + /// Resource location. + public string Location { get; set; } + + /// UUID v4 used to identify the Snapshot. + public string SnapshotId + { + get + { + return Properties is null ? default : Properties.SnapshotId; + } + } + + /// The creation date of the snapshot. + public DateTimeOffset? Created + { + get + { + return Properties is null ? default : Properties.Created; + } + } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPoliciesGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPoliciesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..293dccb34068 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPoliciesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class SnapshotPoliciesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly SnapshotPolicies _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of SnapshotPoliciesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The SnapshotPolicies client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public SnapshotPoliciesGetAllAsyncCollectionResultOfT(SnapshotPolicies client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of SnapshotPoliciesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SnapshotPoliciesGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + SnapshotPoliciesList result = SnapshotPoliciesList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SnapshotPolicyCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPoliciesGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPoliciesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..8c81e9e5f8c7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPoliciesGetAllCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class SnapshotPoliciesGetAllCollectionResultOfT : Pageable + { + private readonly SnapshotPolicies _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of SnapshotPoliciesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The SnapshotPolicies client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public SnapshotPoliciesGetAllCollectionResultOfT(SnapshotPolicies client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of SnapshotPoliciesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SnapshotPoliciesGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + SnapshotPoliciesList result = SnapshotPoliciesList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SnapshotPolicyCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyCollection.cs index 94e871f34fcc..9e8a46980824 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyCollection.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyCollection.cs @@ -8,67 +8,66 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.NetApp { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetSnapshotPolicies method from an instance of . + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetSnapshotPolicies method from an instance of the parent resource. /// public partial class SnapshotPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _snapshotPolicyClientDiagnostics; - private readonly SnapshotPoliciesRestOperations _snapshotPolicyRestClient; + private readonly ClientDiagnostics _snapshotPoliciesClientDiagnostics; + private readonly SnapshotPolicies _snapshotPoliciesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of SnapshotPolicyCollection for mocking. protected SnapshotPolicyCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal SnapshotPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _snapshotPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", SnapshotPolicyResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(SnapshotPolicyResource.ResourceType, out string snapshotPolicyApiVersion); - _snapshotPolicyRestClient = new SnapshotPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, snapshotPolicyApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _snapshotPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", SnapshotPolicyResource.ResourceType.Namespace, Diagnostics); + _snapshotPoliciesRestClient = new SnapshotPolicies(_snapshotPoliciesClientDiagnostics, Pipeline, Endpoint, snapshotPolicyApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != NetAppAccountResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, NetAppAccountResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, NetAppAccountResource.ResourceType), id); + } } /// /// Create a snapshot policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Operation Id - /// SnapshotPolicies_Create + /// Operation Id. + /// SnapshotPolicies_Create. /// /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// @@ -76,23 +75,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the snapshot policy. /// Snapshot policy object supplied in the body of the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string snapshotPolicyName, SnapshotPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyCollection.CreateOrUpdate"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _snapshotPolicyRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, data, cancellationToken).ConfigureAwait(false); - var uri = _snapshotPolicyRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new NetAppArmOperation(Response.FromValue(new SnapshotPolicyResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, SnapshotPolicyData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + NetAppArmOperation operation = new NetAppArmOperation(Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -106,20 +113,16 @@ public virtual async Task> CreateOrUpdateAs /// Create a snapshot policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Create + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// SnapshotPolicies_Create. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// @@ -127,23 +130,31 @@ public virtual async Task> CreateOrUpdateAs /// The name of the snapshot policy. /// Snapshot policy object supplied in the body of the operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string snapshotPolicyName, SnapshotPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyCollection.CreateOrUpdate"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyCollection.CreateOrUpdate"); scope.Start(); try { - var response = _snapshotPolicyRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, data, cancellationToken); - var uri = _snapshotPolicyRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new NetAppArmOperation(Response.FromValue(new SnapshotPolicyResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, SnapshotPolicyData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + NetAppArmOperation operation = new NetAppArmOperation(Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -157,38 +168,42 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// Get a snapshot Policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// SnapshotPolicies_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the snapshot policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyCollection.Get"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyCollection.Get"); scope.Start(); try { - var response = await _snapshotPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -202,38 +217,42 @@ public virtual async Task> GetAsync(string snap /// Get a snapshot Policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// SnapshotPolicies_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the snapshot policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string snapshotPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyCollection.Get"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyCollection.Get"); scope.Start(); try { - var response = _snapshotPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -243,98 +262,78 @@ public virtual Response Get(string snapshotPolicyName, C } } - /// - /// List snapshot policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies - /// - /// - /// Operation Id - /// SnapshotPolicies_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// List snapshot policy. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _snapshotPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new SnapshotPolicyResource(Client, SnapshotPolicyData.DeserializeSnapshotPolicyData(e)), _snapshotPolicyClientDiagnostics, Pipeline, "SnapshotPolicyCollection.GetAll", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new SnapshotPoliciesGetAllAsyncCollectionResultOfT(_snapshotPoliciesRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new SnapshotPolicyResource(Client, data)); } - /// - /// List snapshot policy - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies - /// - /// - /// Operation Id - /// SnapshotPolicies_List - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// List snapshot policy. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _snapshotPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new SnapshotPolicyResource(Client, SnapshotPolicyData.DeserializeSnapshotPolicyData(e)), _snapshotPolicyClientDiagnostics, Pipeline, "SnapshotPolicyCollection.GetAll", "value", null, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new SnapshotPoliciesGetAllCollectionResultOfT(_snapshotPoliciesRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context), data => new SnapshotPolicyResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Get a snapshot Policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Operation Id - /// SnapshotPolicies_Get + /// Operation Id. + /// SnapshotPolicies_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the snapshot policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyCollection.Exists"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyCollection.Exists"); scope.Start(); try { - var response = await _snapshotPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SnapshotPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -345,39 +344,53 @@ public virtual async Task> ExistsAsync(string snapshotPolicyName, } /// - /// Checks to see if the resource exists in azure. + /// Get a snapshot Policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// SnapshotPolicies_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the snapshot policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string snapshotPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyCollection.Exists"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyCollection.Exists"); scope.Start(); try { - var response = _snapshotPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SnapshotPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -388,41 +401,57 @@ public virtual Response Exists(string snapshotPolicyName, CancellationToke } /// - /// Tries to get details for this resource from the service. + /// Get a snapshot Policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// SnapshotPolicies_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the snapshot policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string snapshotPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyCollection.GetIfExists"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyCollection.GetIfExists"); scope.Start(); try { - var response = await _snapshotPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SnapshotPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -433,41 +462,57 @@ public virtual async Task> GetIfExistsA } /// - /// Tries to get details for this resource from the service. + /// Get a snapshot Policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Operation Id. + /// SnapshotPolicies_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-09-01-preview. /// /// /// /// The name of the snapshot policy. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string snapshotPolicyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(snapshotPolicyName, nameof(snapshotPolicyName)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyCollection.GetIfExists"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyCollection.GetIfExists"); scope.Start(); try { - var response = _snapshotPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, snapshotPolicyName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, snapshotPolicyName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SnapshotPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -487,6 +532,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyData.Serialization.cs index b74cc3cd0eff..034e1a936169 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyData.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyData.Serialization.cs @@ -10,16 +10,23 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.NetApp.Models; namespace Azure.ResourceManager.NetApp { - public partial class SnapshotPolicyData : IUtf8JsonSerializable, IJsonModel + /// Snapshot policy information. + public partial class SnapshotPolicyData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal SnapshotPolicyData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,231 +38,149 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SnapshotPolicyData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); - writer.WriteStringValue(ETag.Value.ToString()); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(HourlySchedule)) - { - writer.WritePropertyName("hourlySchedule"u8); - writer.WriteObjectValue(HourlySchedule, options); - } - if (Optional.IsDefined(DailySchedule)) - { - writer.WritePropertyName("dailySchedule"u8); - writer.WriteObjectValue(DailySchedule, options); - } - if (Optional.IsDefined(WeeklySchedule)) - { - writer.WritePropertyName("weeklySchedule"u8); - writer.WriteObjectValue(WeeklySchedule, options); + writer.WriteStringValue(ETag); } - if (Optional.IsDefined(MonthlySchedule)) - { - writer.WritePropertyName("monthlySchedule"u8); - writer.WriteObjectValue(MonthlySchedule, options); - } - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - writer.WriteEndObject(); } - SnapshotPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SnapshotPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (SnapshotPolicyData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(SnapshotPolicyData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSnapshotPolicyData(document.RootElement, options); } - internal static SnapshotPolicyData DeserializeSnapshotPolicyData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SnapshotPolicyData DeserializeSnapshotPolicyData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - ETag? etag = default; - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - SnapshotPolicyHourlySchedule hourlySchedule = default; - SnapshotPolicyDailySchedule dailySchedule = default; - SnapshotPolicyWeeklySchedule weeklySchedule = default; - SnapshotPolicyMonthlySchedule monthlySchedule = default; - bool? enabled = default; - string provisioningState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + SnapshotPolicyProperties properties = default; + string eTag = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("etag"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - etag = new ETag(property.Value.GetString()); - continue; - } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("name"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("type"u8)) { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("hourlySchedule"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hourlySchedule = SnapshotPolicyHourlySchedule.DeserializeSnapshotPolicyHourlySchedule(property0.Value, options); - continue; - } - if (property0.NameEquals("dailySchedule"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dailySchedule = SnapshotPolicyDailySchedule.DeserializeSnapshotPolicyDailySchedule(property0.Value, options); - continue; - } - if (property0.NameEquals("weeklySchedule"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - weeklySchedule = SnapshotPolicyWeeklySchedule.DeserializeSnapshotPolicyWeeklySchedule(property0.Value, options); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("monthlySchedule"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - monthlySchedule = SnapshotPolicyMonthlySchedule.DeserializeSnapshotPolicyMonthlySchedule(property0.Value, options); - continue; - } - if (property0.NameEquals("enabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = SnapshotPolicyProperties.DeserializeSnapshotPolicyProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("etag"u8)) + { + eTag = prop.Value.GetString(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new SnapshotPolicyData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, tags ?? new ChangeTrackingDictionary(), location, - etag, - hourlySchedule, - dailySchedule, - weeklySchedule, - monthlySchedule, - enabled, - provisioningState, - serializedAdditionalRawData); + properties, + eTag); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -265,15 +190,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - SnapshotPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + SnapshotPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (SnapshotPolicyData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeSnapshotPolicyData(document.RootElement, options); } default: @@ -281,6 +211,27 @@ SnapshotPolicyData IPersistableModel.Create(BinaryData data, } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(SnapshotPolicyData snapshotPolicyData) + { + if (snapshotPolicyData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(snapshotPolicyData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static SnapshotPolicyData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSnapshotPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyData.cs index c700f270419b..9e05b0789e08 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyData.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyData.cs @@ -13,95 +13,134 @@ namespace Azure.ResourceManager.NetApp { - /// - /// A class representing the SnapshotPolicy data model. - /// Snapshot policy information - /// + /// Snapshot policy information. public partial class SnapshotPolicyData : TrackedResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. + /// The geo-location where the resource lives. public SnapshotPolicyData(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// A unique read-only string that changes whenever the resource is updated. - /// Schedule for hourly snapshots. - /// Schedule for daily snapshots. - /// Schedule for weekly snapshots. - /// Schedule for monthly snapshots. - /// The property to decide policy is enabled or not. - /// Azure lifecycle management. - /// Keeps track of any properties unknown to the library. - internal SnapshotPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, SnapshotPolicyHourlySchedule hourlySchedule, SnapshotPolicyDailySchedule dailySchedule, SnapshotPolicyWeeklySchedule weeklySchedule, SnapshotPolicyMonthlySchedule monthlySchedule, bool? isEnabled, string provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// Snapshot policy Properties. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + internal SnapshotPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, SnapshotPolicyProperties properties, string eTag) : base(id, name, resourceType, systemData, tags, location) { - ETag = etag; - HourlySchedule = hourlySchedule; - DailySchedule = dailySchedule; - WeeklySchedule = weeklySchedule; - MonthlySchedule = monthlySchedule; - IsEnabled = isEnabled; - ProvisioningState = provisioningState; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; } - /// Initializes a new instance of for deserialization. - internal SnapshotPolicyData() + /// Snapshot policy Properties. + internal SnapshotPolicyProperties Properties { get; set; } + + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + public string ETag { get; } + + /// Schedule for hourly snapshots. + public HourlySchedule HourlySchedule { + get + { + return Properties is null ? default : Properties.HourlySchedule; + } + set + { + if (Properties is null) + { + Properties = new SnapshotPolicyProperties(); + } + Properties.HourlySchedule = value; + } } - /// A unique read-only string that changes whenever the resource is updated. - public ETag? ETag { get; } - /// Schedule for hourly snapshots. - public SnapshotPolicyHourlySchedule HourlySchedule { get; set; } /// Schedule for daily snapshots. - public SnapshotPolicyDailySchedule DailySchedule { get; set; } + public DailySchedule DailySchedule + { + get + { + return Properties is null ? default : Properties.DailySchedule; + } + set + { + if (Properties is null) + { + Properties = new SnapshotPolicyProperties(); + } + Properties.DailySchedule = value; + } + } + /// Schedule for weekly snapshots. - public SnapshotPolicyWeeklySchedule WeeklySchedule { get; set; } + public WeeklySchedule WeeklySchedule + { + get + { + return Properties is null ? default : Properties.WeeklySchedule; + } + set + { + if (Properties is null) + { + Properties = new SnapshotPolicyProperties(); + } + Properties.WeeklySchedule = value; + } + } + /// Schedule for monthly snapshots. - public SnapshotPolicyMonthlySchedule MonthlySchedule { get; set; } + public MonthlySchedule MonthlySchedule + { + get + { + return Properties is null ? default : Properties.MonthlySchedule; + } + set + { + if (Properties is null) + { + Properties = new SnapshotPolicyProperties(); + } + Properties.MonthlySchedule = value; + } + } + /// The property to decide policy is enabled or not. - public bool? IsEnabled { get; set; } + public bool? Enabled + { + get + { + return Properties is null ? default : Properties.Enabled; + } + set + { + if (Properties is null) + { + Properties = new SnapshotPolicyProperties(); + } + Properties.Enabled = value.Value; + } + } + /// Azure lifecycle management. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.Serialization.cs index 5ef3ed922783..837719708bdf 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.Serialization.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.NetApp { + /// public partial class SnapshotPolicyResource : IJsonModel { - private static SnapshotPolicyData s_dataDeserializationInstance; - private static SnapshotPolicyData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new SnapshotPolicyData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - SnapshotPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + SnapshotPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. SnapshotPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.cs index 400401844d2f..d2082ad18125 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotPolicyResource.cs @@ -7,48 +7,37 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.NetApp { /// - /// A Class representing a SnapshotPolicy along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetSnapshotPolicyResource method. - /// Otherwise you can get one from its parent resource using the GetSnapshotPolicy method. + /// A class representing a SnapshotPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetSnapshotPolicies method. /// public partial class SnapshotPolicyResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The accountName. - /// The snapshotPolicyName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _snapshotPolicyClientDiagnostics; - private readonly SnapshotPoliciesRestOperations _snapshotPolicyRestClient; + private readonly ClientDiagnostics _snapshotPoliciesClientDiagnostics; + private readonly SnapshotPolicies _snapshotPoliciesRestClient; private readonly SnapshotPolicyData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/snapshotPolicies"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of SnapshotPolicyResource for mocking. protected SnapshotPolicyResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal SnapshotPolicyResource(ArmClient client, SnapshotPolicyData data) : this(client, data.Id) @@ -57,71 +46,93 @@ internal SnapshotPolicyResource(ArmClient client, SnapshotPolicyData data) : thi _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal SnapshotPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _snapshotPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string snapshotPolicyApiVersion); - _snapshotPolicyRestClient = new SnapshotPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, snapshotPolicyApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _snapshotPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _snapshotPoliciesRestClient = new SnapshotPolicies(_snapshotPoliciesClientDiagnostics, Pipeline, Endpoint, snapshotPolicyApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); } /// Gets whether or not the current instance has data. public virtual bool HasData { get; } /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. public virtual SnapshotPolicyData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The snapshotPolicyName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string snapshotPolicyName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get a snapshot Policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Operation Id - /// SnapshotPolicies_Get + /// Operation Id. + /// SnapshotPolicies_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.Get"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.Get"); scope.Start(); try { - var response = await _snapshotPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -135,33 +146,41 @@ public virtual async Task> GetAsync(Cancellatio /// Get a snapshot Policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Operation Id - /// SnapshotPolicies_Get + /// Operation Id. + /// SnapshotPolicies_Get. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.Get"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.Get"); scope.Start(); try { - var response = _snapshotPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -172,38 +191,55 @@ public virtual Response Get(CancellationToken cancellati } /// - /// Delete snapshot policy + /// Patch a snapshot policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Operation Id - /// SnapshotPolicies_Delete + /// Operation Id. + /// SnapshotPolicies_Update. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Snapshot policy object supplied in the body of the operation. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SnapshotPolicyPatch patch, CancellationToken cancellationToken = default) { - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.Update"); scope.Start(); try { - var response = await _snapshotPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(_snapshotPolicyClientDiagnostics, Pipeline, _snapshotPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, SnapshotPolicyPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new SnapshotPolicyOperationSource(Client), + _snapshotPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -214,38 +250,55 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete snapshot policy + /// Patch a snapshot policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Operation Id - /// SnapshotPolicies_Delete + /// Operation Id. + /// SnapshotPolicies_Update. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Snapshot policy object supplied in the body of the operation. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SnapshotPolicyPatch patch, CancellationToken cancellationToken = default) { - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.Update"); scope.Start(); try { - var response = _snapshotPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new NetAppArmOperation(_snapshotPolicyClientDiagnostics, Pipeline, _snapshotPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, SnapshotPolicyPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new SnapshotPolicyOperationSource(Client), + _snapshotPoliciesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + { + operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -256,42 +309,45 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Patch a snapshot policy + /// Delete snapshot policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Operation Id - /// SnapshotPolicies_Update + /// Operation Id. + /// SnapshotPolicies_Delete. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Snapshot policy object supplied in the body of the operation. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, SnapshotPolicyPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.Update"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.Delete"); scope.Start(); try { - var response = await _snapshotPolicyRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new NetAppArmOperation(new SnapshotPolicyOperationSource(Client), _snapshotPolicyClientDiagnostics, Pipeline, _snapshotPolicyRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_snapshotPoliciesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -302,42 +358,45 @@ public virtual async Task> UpdateAsync(Wait } /// - /// Patch a snapshot policy + /// Delete snapshot policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}. /// /// - /// Operation Id - /// SnapshotPolicies_Update + /// Operation Id. + /// SnapshotPolicies_Delete. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Snapshot policy object supplied in the body of the operation. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, SnapshotPolicyPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.Update"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.Delete"); scope.Start(); try { - var response = _snapshotPolicyRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - var operation = new NetAppArmOperation(new SnapshotPolicyOperationSource(Client), _snapshotPolicyClientDiagnostics, Pipeline, _snapshotPolicyRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_snapshotPoliciesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + { + operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -351,81 +410,99 @@ public virtual ArmOperation Update(WaitUntil waitUntil, /// Get volumes associated with snapshot policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes. /// /// - /// Operation Id - /// SnapshotPolicies_ListVolumes + /// Operation Id. + /// SnapshotPolicies_ListVolumes. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVolumesAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetVolumesAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _snapshotPolicyRestClient.CreateListVolumesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new NetAppVolumeResource(Client, NetAppVolumeData.DeserializeNetAppVolumeData(e)), _snapshotPolicyClientDiagnostics, Pipeline, "SnapshotPolicyResource.GetVolumes", "value", null, cancellationToken); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.GetVolumes"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetVolumesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SnapshotPolicyVolumeList.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// /// Get volumes associated with snapshot policy /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes. /// /// - /// Operation Id - /// SnapshotPolicies_ListVolumes + /// Operation Id. + /// SnapshotPolicies_ListVolumes. /// /// - /// Default Api Version - /// 2025-07-01-preview + /// Default Api Version. + /// 2025-09-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVolumes(CancellationToken cancellationToken = default) + public virtual Response GetVolumes(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _snapshotPolicyRestClient.CreateListVolumesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new NetAppVolumeResource(Client, NetAppVolumeData.DeserializeNetAppVolumeData(e)), _snapshotPolicyClientDiagnostics, Pipeline, "SnapshotPolicyResource.GetVolumes", "value", null, cancellationToken); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.GetVolumes"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetVolumesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SnapshotPolicyVolumeList.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -435,28 +512,34 @@ public virtual async Task> AddTagAsync(string k Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.AddTag"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.AddTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _snapshotPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new SnapshotPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new SnapshotPolicyPatch(current.Location); - foreach (var tag in current.Tags) + SnapshotPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + SnapshotPolicyPatch patch = new SnapshotPolicyPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -467,27 +550,7 @@ public virtual async Task> AddTagAsync(string k } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -497,28 +560,34 @@ public virtual Response AddTag(string key, string value, Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.AddTag"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.AddTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _snapshotPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new SnapshotPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new SnapshotPolicyPatch(current.Location); - foreach (var tag in current.Tags) + SnapshotPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + SnapshotPolicyPatch patch = new SnapshotPolicyPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -529,53 +598,39 @@ public virtual Response AddTag(string key, string value, } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.SetTags"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.SetTags"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _snapshotPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new SnapshotPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new SnapshotPolicyPatch(current.Location); + SnapshotPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + SnapshotPolicyPatch patch = new SnapshotPolicyPatch(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -586,53 +641,39 @@ public virtual async Task> SetTagsAsync(IDictio } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.SetTags"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.SetTags"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _snapshotPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new SnapshotPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new SnapshotPolicyPatch(current.Location); + SnapshotPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + SnapshotPolicyPatch patch = new SnapshotPolicyPatch(); patch.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -643,27 +684,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -671,28 +692,34 @@ public virtual async Task> RemoveTagAsync(strin { Argument.AssertNotNull(key, nameof(key)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.RemoveTag"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.RemoveTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _snapshotPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new SnapshotPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new SnapshotPolicyPatch(current.Location); - foreach (var tag in current.Tags) + SnapshotPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + SnapshotPolicyPatch patch = new SnapshotPolicyPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -703,27 +730,7 @@ public virtual async Task> RemoveTagAsync(strin } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName} - /// - /// - /// Operation Id - /// SnapshotPolicies_Get - /// - /// - /// Default Api Version - /// 2025-07-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -731,28 +738,34 @@ public virtual Response RemoveTag(string key, Cancellati { Argument.AssertNotNull(key, nameof(key)); - using var scope = _snapshotPolicyClientDiagnostics.CreateScope("SnapshotPolicyResource.RemoveTag"); + using DiagnosticScope scope = _snapshotPoliciesClientDiagnostics.CreateScope("SnapshotPolicyResource.RemoveTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _snapshotPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new SnapshotPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotPoliciesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SnapshotPolicyData.FromResponse(result), result); + return Response.FromValue(new SnapshotPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new SnapshotPolicyPatch(current.Location); - foreach (var tag in current.Tags) + SnapshotPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + SnapshotPolicyPatch patch = new SnapshotPolicyPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotResource.Serialization.cs new file mode 100644 index 000000000000..b92e3cc245f7 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class SnapshotResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new SnapshotData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + SnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + SnapshotData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotResource.cs new file mode 100644 index 000000000000..c2c52ab69979 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotResource.cs @@ -0,0 +1,515 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a Snapshot along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetSnapshots method. + /// + public partial class SnapshotResource : ArmResource + { + private readonly ClientDiagnostics _snapshotsClientDiagnostics; + private readonly Snapshots _snapshotsRestClient; + private readonly SnapshotData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots"; + + /// Initializes a new instance of SnapshotResource for mocking. + protected SnapshotResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SnapshotResource(ArmClient client, SnapshotData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SnapshotResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string snapshotApiVersion); + _snapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _snapshotsRestClient = new Snapshots(_snapshotsClientDiagnostics, Pipeline, Endpoint, snapshotApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual SnapshotData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + /// The snapshotName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string snapshotName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get details of the specified snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SnapshotData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SnapshotData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new SnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch a snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Snapshot object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SnapshotPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, SnapshotPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new SnapshotOperationSource(Client), + _snapshotsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch a snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Snapshot object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SnapshotPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, SnapshotPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new SnapshotOperationSource(Client), + _snapshotsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_snapshotsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete snapshot + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}. + /// + /// + /// Operation Id. + /// Snapshots_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_snapshotsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Restore the specified files from the specified snapshot to the active filesystem + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles. + /// + /// + /// Operation Id. + /// Snapshots_RestoreFiles. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Restore payload supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task RestoreFilesAsync(WaitUntil waitUntil, SnapshotRestoreFiles body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotResource.RestoreFiles"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateRestoreFilesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, SnapshotRestoreFiles.ToRequestContent(body), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_snapshotsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Restore the specified files from the specified snapshot to the active filesystem + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles. + /// + /// + /// Operation Id. + /// Snapshots_RestoreFiles. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Restore payload supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation RestoreFiles(WaitUntil waitUntil, SnapshotRestoreFiles body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using DiagnosticScope scope = _snapshotsClientDiagnostics.CreateScope("SnapshotResource.RestoreFiles"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _snapshotsRestClient.CreateRestoreFilesRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, SnapshotRestoreFiles.ToRequestContent(body), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_snapshotsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotsGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..ddea0c4dff44 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class SnapshotsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Snapshots _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of SnapshotsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Snapshots client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public SnapshotsGetAllAsyncCollectionResultOfT(Snapshots client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of SnapshotsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SnapshotsGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + SnapshotsList result = SnapshotsList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SnapshotCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotsGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..e00d19cf08b5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SnapshotsGetAllCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class SnapshotsGetAllCollectionResultOfT : Pageable + { + private readonly Snapshots _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of SnapshotsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Snapshots client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public SnapshotsGetAllCollectionResultOfT(Snapshots client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of SnapshotsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SnapshotsGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + SnapshotsList result = SnapshotsList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SnapshotCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoCollection.cs new file mode 100644 index 000000000000..2dc735afb278 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoCollection.cs @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetSubvolumeInfos method from an instance of the parent resource. + /// + public partial class SubvolumeInfoCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _subvolumesClientDiagnostics; + private readonly Subvolumes _subvolumesRestClient; + + /// Initializes a new instance of SubvolumeInfoCollection for mocking. + protected SubvolumeInfoCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SubvolumeInfoCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(SubvolumeInfoResource.ResourceType, out string subvolumeInfoApiVersion); + _subvolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", SubvolumeInfoResource.ResourceType.Namespace, Diagnostics); + _subvolumesRestClient = new Subvolumes(_subvolumesClientDiagnostics, Pipeline, Endpoint, subvolumeInfoApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != VolumeResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, VolumeResource.ResourceType), id); + } + } + + /// + /// Creates a subvolume in the path or clones the subvolume mentioned in the parentPath + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the subvolume. + /// Subvolume object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string subvolumeName, SubvolumeInfoData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, SubvolumeInfoData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new SubvolumeInfoOperationSource(Client), + _subvolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a subvolume in the path or clones the subvolume mentioned in the parentPath + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the subvolume. + /// Subvolume object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string subvolumeName, SubvolumeInfoData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, SubvolumeInfoData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new SubvolumeInfoOperationSource(Client), + _subvolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the path associated with the subvolumeName provided + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the subvolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string subvolumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SubvolumeInfoData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new SubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the path associated with the subvolumeName provided + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the subvolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string subvolumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SubvolumeInfoData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new SubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a list of the subvolumes in the volume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new SubvolumesGetByVolumeAsyncCollectionResultOfT( + _subvolumesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new SubvolumeInfoResource(Client, data)); + } + + /// Returns a list of the subvolumes in the volume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new SubvolumesGetByVolumeCollectionResultOfT( + _subvolumesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new SubvolumeInfoResource(Client, data)); + } + + /// + /// Returns the path associated with the subvolumeName provided + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the subvolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string subvolumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SubvolumeInfoData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SubvolumeInfoData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the path associated with the subvolumeName provided + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the subvolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string subvolumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SubvolumeInfoData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SubvolumeInfoData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the path associated with the subvolumeName provided + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the subvolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string subvolumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SubvolumeInfoData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SubvolumeInfoData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new SubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the path associated with the subvolumeName provided + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the subvolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string subvolumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, subvolumeName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(SubvolumeInfoData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((SubvolumeInfoData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new SubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoData.Serialization.cs new file mode 100644 index 000000000000..2fc5dba7a6c2 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoData.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Subvolume Information properties. + public partial class SubvolumeInfoData : ResourceData, IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumeInfoData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SubvolumeInfoData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (SubvolumeInfoData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubvolumeInfoData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubvolumeInfoData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SubvolumeInfoData DeserializeSubvolumeInfoData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + SubvolumeProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SubvolumeProperties.DeserializeSubvolumeProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SubvolumeInfoData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(SubvolumeInfoData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SubvolumeInfoData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (SubvolumeInfoData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSubvolumeInfoData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubvolumeInfoData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(SubvolumeInfoData subvolumeInfoData) + { + if (subvolumeInfoData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(subvolumeInfoData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static SubvolumeInfoData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeSubvolumeInfoData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoData.cs new file mode 100644 index 000000000000..8c377f3c1216 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoData.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Subvolume Information properties. + public partial class SubvolumeInfoData : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SubvolumeInfoData() + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Subvolume Properties. + internal SubvolumeInfoData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, SubvolumeProperties properties) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// Subvolume Properties. + internal SubvolumeProperties Properties { get; set; } + + /// Path to the subvolume. + public string Path + { + get + { + return Properties is null ? default : Properties.Path; + } + set + { + if (Properties is null) + { + Properties = new SubvolumeProperties(); + } + Properties.Path = value; + } + } + + /// Truncate subvolume to the provided size in bytes. + public long? Size + { + get + { + return Properties is null ? default : Properties.Size; + } + set + { + if (Properties is null) + { + Properties = new SubvolumeProperties(); + } + Properties.Size = value.Value; + } + } + + /// parent path to the subvolume. + public string ParentPath + { + get + { + return Properties is null ? default : Properties.ParentPath; + } + set + { + if (Properties is null) + { + Properties = new SubvolumeProperties(); + } + Properties.ParentPath = value; + } + } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoResource.Serialization.cs new file mode 100644 index 000000000000..827761fe6ae0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class SubvolumeInfoResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new SubvolumeInfoData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + SubvolumeInfoData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + SubvolumeInfoData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoResource.cs new file mode 100644 index 000000000000..70b37cd754a3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumeInfoResource.cs @@ -0,0 +1,519 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a SubvolumeInfo along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetSubvolumeInfos method. + /// + public partial class SubvolumeInfoResource : ArmResource + { + private readonly ClientDiagnostics _subvolumesClientDiagnostics; + private readonly Subvolumes _subvolumesRestClient; + private readonly SubvolumeInfoData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/subvolumes"; + + /// Initializes a new instance of SubvolumeInfoResource for mocking. + protected SubvolumeInfoResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SubvolumeInfoResource(ArmClient client, SubvolumeInfoData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SubvolumeInfoResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string subvolumeInfoApiVersion); + _subvolumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _subvolumesRestClient = new Subvolumes(_subvolumesClientDiagnostics, Pipeline, Endpoint, subvolumeInfoApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual SubvolumeInfoData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + /// The subvolumeName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string subvolumeName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Returns the path associated with the subvolumeName provided + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(SubvolumeInfoData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new SubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the path associated with the subvolumeName provided + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(SubvolumeInfoData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new SubvolumeInfoResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch a subvolume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Subvolume object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SubvolumeInfoPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, SubvolumeInfoPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new SubvolumeInfoOperationSource(Client), + _subvolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch a subvolume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Subvolume object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SubvolumeInfoPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, SubvolumeInfoPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new SubvolumeInfoOperationSource(Client), + _subvolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete subvolume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_subvolumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete subvolume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}. + /// + /// + /// Operation Id. + /// SubvolumeInfos_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_subvolumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified subvolume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata. + /// + /// + /// Operation Id. + /// SubvolumeInfos_GetMetadata. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> GetMetadataAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoResource.GetMetadata"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateGetMetadataRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new SubvolumeModelOperationSource(), + _subvolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified subvolume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata. + /// + /// + /// Operation Id. + /// SubvolumeInfos_GetMetadata. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation GetMetadata(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _subvolumesClientDiagnostics.CreateScope("SubvolumeInfoResource.GetMetadata"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _subvolumesRestClient.CreateGetMetadataRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new SubvolumeModelOperationSource(), + _subvolumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumesGetByVolumeAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumesGetByVolumeAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..0047e97afebb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumesGetByVolumeAsyncCollectionResultOfT.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class SubvolumesGetByVolumeAsyncCollectionResultOfT : AsyncPageable + { + private readonly Subvolumes _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of SubvolumesGetByVolumeAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Subvolumes client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public SubvolumesGetByVolumeAsyncCollectionResultOfT(Subvolumes client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of SubvolumesGetByVolumeAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SubvolumesGetByVolumeAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + SubvolumesList result = SubvolumesList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByVolumeRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetByVolumeRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SubvolumeInfoCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumesGetByVolumeCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumesGetByVolumeCollectionResultOfT.cs new file mode 100644 index 000000000000..f82f3120ff50 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/SubvolumesGetByVolumeCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class SubvolumesGetByVolumeCollectionResultOfT : Pageable + { + private readonly Subvolumes _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of SubvolumesGetByVolumeCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Subvolumes client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public SubvolumesGetByVolumeCollectionResultOfT(Subvolumes client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of SubvolumesGetByVolumeCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SubvolumesGetByVolumeCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + SubvolumesList result = SubvolumesList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByVolumeRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetByVolumeRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("SubvolumeInfoCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeCollection.cs new file mode 100644 index 000000000000..c89772e09f40 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeCollection.cs @@ -0,0 +1,567 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetVolumes method from an instance of the parent resource. + /// + public partial class VolumeCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _backupsClientDiagnostics; + private readonly Backups _backupsRestClient; + private readonly ClientDiagnostics _volumesClientDiagnostics; + private readonly Volumes _volumesRestClient; + private readonly ClientDiagnostics _backupsUnderVolumeClientDiagnostics; + private readonly BackupsUnderVolume _backupsUnderVolumeRestClient; + + /// Initializes a new instance of VolumeCollection for mocking. + protected VolumeCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal VolumeCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(VolumeResource.ResourceType, out string volumeApiVersion); + _backupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", VolumeResource.ResourceType.Namespace, Diagnostics); + _backupsRestClient = new Backups(_backupsClientDiagnostics, Pipeline, Endpoint, volumeApiVersion ?? "2025-09-01-preview"); + _volumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", VolumeResource.ResourceType.Namespace, Diagnostics); + _volumesRestClient = new Volumes(_volumesClientDiagnostics, Pipeline, Endpoint, volumeApiVersion ?? "2025-09-01-preview"); + _backupsUnderVolumeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", VolumeResource.ResourceType.Namespace, Diagnostics); + _backupsUnderVolumeRestClient = new BackupsUnderVolume(_backupsUnderVolumeClientDiagnostics, Pipeline, Endpoint, volumeApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != CapacityPoolResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, CapacityPoolResource.ResourceType), id); + } + } + + /// + /// Create or update the specified volume within the capacity pool + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the volume. + /// Volume object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string volumeName, VolumeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, VolumeData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeOperationSource(Client), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update the specified volume within the capacity pool + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_CreateOrUpdate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the volume. + /// Volume object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string volumeName, VolumeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, VolumeData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeOperationSource(Client), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all volumes within the capacity pool. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new VolumesGetAllAsyncCollectionResultOfT( + _volumesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new VolumeResource(Client, data)); + } + + /// List all volumes within the capacity pool. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new VolumesGetAllCollectionResultOfT( + _volumesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new VolumeResource(Client, data)); + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string volumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, volumeName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeData.Serialization.cs new file mode 100644 index 000000000000..46376f9b29b5 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeData.Serialization.cs @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Volume resource. + public partial class VolumeData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal VolumeData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (string item in Zones) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (VolumeData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeData DeserializeVolumeData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + VolumeProperties properties = default; + string eTag = default; + IList zones = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = VolumeProperties.DeserializeVolumeProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("etag"u8)) + { + eTag = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("zones"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + zones = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + eTag, + zones ?? new ChangeTrackingList()); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (VolumeData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(VolumeData volumeData) + { + if (volumeData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(volumeData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static VolumeData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeVolumeData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeData.cs new file mode 100644 index 000000000000..e54e3c0ef001 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeData.cs @@ -0,0 +1,982 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Volume resource. + public partial class VolumeData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + /// A unique file path for the volume. Used when creating mount targets. + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. + /// or is null. + public VolumeData(AzureLocation location, string creationToken, long usageThreshold, string subnetId) : base(location) + { + Argument.AssertNotNull(creationToken, nameof(creationToken)); + Argument.AssertNotNull(subnetId, nameof(subnetId)); + + CreationToken = creationToken; + UsageThreshold = usageThreshold; + SubnetId = subnetId; + Zones = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// Volume properties. + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + /// The availability zones. + internal VolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, VolumeProperties properties, string eTag, IList zones) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + ETag = eTag; + Zones = zones; + } + + /// Volume properties. + internal VolumeProperties Properties { get; set; } + + /// "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields."). + public string ETag { get; } + + /// The availability zones. + public IList Zones { get; } + + /// Unique FileSystem Identifier. + public string FileSystemId + { + get + { + return Properties is null ? default : Properties.FileSystemId; + } + } + + /// A unique file path for the volume. Used when creating mount targets. + public string CreationToken + { + get + { + return Properties is null ? default : Properties.CreationToken; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CreationToken = value; + } + } + + /// The service level of the file system. + public NetAppFileServiceLevel? ServiceLevel + { + get + { + return Properties is null ? default : Properties.ServiceLevel; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.ServiceLevel = value.Value; + } + } + + /// + /// Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. For regular volumes, valid values are in the range 50GiB to 100TiB. + /// For large volumes, valid values are in the range 100TiB to 500TiB, and on an exceptional basis, from to 2400GiB to 2400TiB. + /// For extra large volumes, valid values are in the range 2400GiB to 7200TiB. Values expressed in bytes as multiples of 1 GiB. + /// + public long UsageThreshold + { + get + { + return Properties is null ? default : Properties.UsageThreshold; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.UsageThreshold = value; + } + } + + /// Set of protocol types, default NFSv3, CIFS for SMB protocol. + public IList ProtocolTypes + { + get + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + return Properties.ProtocolTypes; + } + } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Resource identifier used to identify the Snapshot. + public ResourceIdentifier SnapshotId + { + get + { + return Properties is null ? default : Properties.SnapshotId; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SnapshotId = value; + } + } + + /// If enabled (true) the snapshot the volume was created from will be automatically deleted after the volume create operation has finished. Defaults to false. + public bool? DeleteBaseSnapshot + { + get + { + return Properties is null ? default : Properties.DeleteBaseSnapshot; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.DeleteBaseSnapshot = value.Value; + } + } + + /// Resource identifier used to identify the Backup. + public ResourceIdentifier BackupId + { + get + { + return Properties is null ? default : Properties.BackupId; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.BackupId = value; + } + } + + /// Unique Baremetal Tenant Identifier. + public string BaremetalTenantId + { + get + { + return Properties is null ? default : Properties.BaremetalTenantId; + } + } + + /// The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. + public string SubnetId + { + get + { + return Properties is null ? default : Properties.SubnetId; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SubnetId = value; + } + } + + /// The original value of the network features type available to the volume at the time it was created. + public NetworkFeatures? NetworkFeatures + { + get + { + return Properties is null ? default : Properties.NetworkFeatures; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.NetworkFeatures = value.Value; + } + } + + /// The effective value of the network features type available to the volume, or current effective state of update. + public NetworkFeatures? EffectiveNetworkFeatures + { + get + { + return Properties is null ? default : Properties.EffectiveNetworkFeatures; + } + } + + /// Network Sibling Set ID for the the group of volumes sharing networking resources. + public string NetworkSiblingSetId + { + get + { + return Properties is null ? default : Properties.NetworkSiblingSetId; + } + } + + /// Provides storage to network proximity information for the volume. + public VolumeStorageToNetworkProximity? StorageToNetworkProximity + { + get + { + return Properties is null ? default : Properties.StorageToNetworkProximity; + } + } + + /// List of mount targets. + public IReadOnlyList MountTargets + { + get + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + return Properties.MountTargets; + } + } + + /// What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. For creating clone volume, set type to ShortTermClone. + public string VolumeType + { + get + { + return Properties is null ? default : Properties.VolumeType; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.VolumeType = value; + } + } + + /// DataProtection type volumes include an object containing details of the replication. + public VolumePropertiesDataProtection DataProtection + { + get + { + return Properties is null ? default : Properties.DataProtection; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.DataProtection = value; + } + } + + /// While auto splitting the short term clone volume, if the parent pool does not have enough space to accommodate the volume after split, it will be automatically resized, which will lead to increased billing. To accept capacity pool size auto grow and create a short term clone volume, set the property as accepted. + public AcceptGrowCapacityPoolForShortTermCloneSplit? AcceptGrowCapacityPoolForShortTermCloneSplit + { + get + { + return Properties is null ? default : Properties.AcceptGrowCapacityPoolForShortTermCloneSplit; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.AcceptGrowCapacityPoolForShortTermCloneSplit = value.Value; + } + } + + /// Restoring. + public bool? IsRestoring + { + get + { + return Properties is null ? default : Properties.IsRestoring; + } + } + + /// If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (defaults to true). + public bool? SnapshotDirectoryVisible + { + get + { + return Properties is null ? default : Properties.SnapshotDirectoryVisible; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SnapshotDirectoryVisible = value.Value; + } + } + + /// Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later. + public bool? KerberosEnabled + { + get + { + return Properties is null ? default : Properties.KerberosEnabled; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.KerberosEnabled = value.Value; + } + } + + /// The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. + public SecurityStyle? SecurityStyle + { + get + { + return Properties is null ? default : Properties.SecurityStyle; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SecurityStyle = value.Value; + } + } + + /// Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. + public bool? SmbEncryption + { + get + { + return Properties is null ? default : Properties.SmbEncryption; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SmbEncryption = value.Value; + } + } + + /// Enables access-based enumeration share property for SMB Shares. Only applicable for SMB/DualProtocol volume. + public SmbAccessBasedEnumeration? SmbAccessBasedEnumeration + { + get + { + return Properties is null ? default : Properties.SmbAccessBasedEnumeration; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SmbAccessBasedEnumeration = value.Value; + } + } + + /// Enables non-browsable property for SMB Shares. Only applicable for SMB/DualProtocol volume. + public SmbNonBrowsable? SmbNonBrowsable + { + get + { + return Properties is null ? default : Properties.SmbNonBrowsable; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SmbNonBrowsable = value.Value; + } + } + + /// Enables continuously available share property for smb volume. Only applicable for SMB volume. + public bool? SmbContinuouslyAvailable + { + get + { + return Properties is null ? default : Properties.SmbContinuouslyAvailable; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.SmbContinuouslyAvailable = value.Value; + } + } + + /// Maximum throughput in MiB/s that can be achieved by this volume and this will be accepted as input only for manual qosType volume. + public float? ThroughputMibps + { + get + { + return Properties is null ? default : Properties.ThroughputMibps; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.ThroughputMibps = value.Value; + } + } + + /// Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel. + public float? ActualThroughputMibps + { + get + { + return Properties is null ? default : Properties.ActualThroughputMibps; + } + } + + /// Source of key used to encrypt data in volume. Applicable if NetApp account has encryption.keySource = 'Microsoft.KeyVault'. Possible values (case-insensitive) are: 'Microsoft.NetApp, Microsoft.KeyVault'. + public EncryptionKeySource? EncryptionKeySource + { + get + { + return Properties is null ? default : Properties.EncryptionKeySource; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.EncryptionKeySource = value.Value; + } + } + + /// The resource ID of private endpoint for KeyVault. It must reside in the same VNET as the volume. Only applicable if encryptionKeySource = 'Microsoft.KeyVault'. + public string KeyVaultPrivateEndpointResourceId + { + get + { + return Properties is null ? default : Properties.KeyVaultPrivateEndpointResourceId; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.KeyVaultPrivateEndpointResourceId = value; + } + } + + /// Specifies whether LDAP is enabled or not for a given NFS volume. + public bool? LdapEnabled + { + get + { + return Properties is null ? default : Properties.LdapEnabled; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.LdapEnabled = value.Value; + } + } + + /// Specifies the type of LDAP server for a given NFS volume. + public LdapServerType? LdapServerType + { + get + { + return Properties is null ? default : Properties.LdapServerType; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.LdapServerType = value.Value; + } + } + + /// Specifies whether Cool Access(tiering) is enabled for the volume. + public bool? CoolAccess + { + get + { + return Properties is null ? default : Properties.CoolAccess; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CoolAccess = value.Value; + } + } + + /// Specifies the number of days after which data that is not accessed by clients will be tiered. + public int? CoolnessPeriod + { + get + { + return Properties is null ? default : Properties.CoolnessPeriod; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CoolnessPeriod = value.Value; + } + } + + /// + /// coolAccessRetrievalPolicy determines the data retrieval behavior from the cool tier to standard storage based on the read pattern for cool access enabled volumes. The possible values for this field are: + /// Default - Data will be pulled from cool tier to standard storage on random reads. This policy is the default. + /// OnRead - All client-driven data read is pulled from cool tier to standard storage on both sequential and random reads. + /// Never - No client-driven data is pulled from cool tier to standard storage. + /// + public CoolAccessRetrievalPolicy? CoolAccessRetrievalPolicy + { + get + { + return Properties is null ? default : Properties.CoolAccessRetrievalPolicy; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CoolAccessRetrievalPolicy = value.Value; + } + } + + /// coolAccessTieringPolicy determines which cold data blocks are moved to cool tier. The possible values for this field are: Auto - Moves cold user data blocks in both the Snapshot copies and the active file system to the cool tier tier. This policy is the default. SnapshotOnly - Moves user data blocks of the Volume Snapshot copies that are not associated with the active file system to the cool tier. + public CoolAccessTieringPolicy? CoolAccessTieringPolicy + { + get + { + return Properties is null ? default : Properties.CoolAccessTieringPolicy; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CoolAccessTieringPolicy = value.Value; + } + } + + /// UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. + public string UnixPermissions + { + get + { + return Properties is null ? default : Properties.UnixPermissions; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.UnixPermissions = value; + } + } + + /// When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. + public int? CloneProgress + { + get + { + return Properties is null ? default : Properties.CloneProgress; + } + } + + /// Flag indicating whether file access logs are enabled for the volume, based on active diagnostic settings present on the volume. + public FileAccessLogs? FileAccessLogs + { + get + { + return Properties is null ? default : Properties.FileAccessLogs; + } + } + + /// Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. + public AvsDataStore? AvsDataStore + { + get + { + return Properties is null ? default : Properties.AvsDataStore; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.AvsDataStore = value.Value; + } + } + + /// Data store resource unique identifier. + public IReadOnlyList DataStoreResourceId + { + get + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + return Properties.DataStoreResourceId; + } + } + + /// Specifies if default quota is enabled for the volume. + public bool? IsDefaultQuotaEnabled + { + get + { + return Properties is null ? default : Properties.IsDefaultQuotaEnabled; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.IsDefaultQuotaEnabled = value.Value; + } + } + + /// Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . + public long? DefaultUserQuotaInKiBs + { + get + { + return Properties is null ? default : Properties.DefaultUserQuotaInKiBs; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.DefaultUserQuotaInKiBs = value.Value; + } + } + + /// Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. + public long? DefaultGroupQuotaInKiBs + { + get + { + return Properties is null ? default : Properties.DefaultGroupQuotaInKiBs; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.DefaultGroupQuotaInKiBs = value.Value; + } + } + + /// Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. + public long? MaximumNumberOfFiles + { + get + { + return Properties is null ? default : Properties.MaximumNumberOfFiles; + } + } + + /// Volume Group Name. + public string VolumeGroupName + { + get + { + return Properties is null ? default : Properties.VolumeGroupName; + } + } + + /// Pool Resource Id used in case of creating a volume through volume group. + public string CapacityPoolResourceId + { + get + { + return Properties is null ? default : Properties.CapacityPoolResourceId; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.CapacityPoolResourceId = value; + } + } + + /// Proximity placement group associated with the volume. + public string ProximityPlacementGroup + { + get + { + return Properties is null ? default : Properties.ProximityPlacementGroup; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.ProximityPlacementGroup = value; + } + } + + /// T2 network information. + public string T2Network + { + get + { + return Properties is null ? default : Properties.T2Network; + } + } + + /// Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log. + public string VolumeSpecName + { + get + { + return Properties is null ? default : Properties.VolumeSpecName; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.VolumeSpecName = value; + } + } + + /// Specifies if the volume is encrypted or not. Only available on volumes created or updated after 2022-01-01. + public bool? Encrypted + { + get + { + return Properties is null ? default : Properties.Encrypted; + } + } + + /// Application specific placement rules for the particular volume. + public IList PlacementRules + { + get + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + return Properties.PlacementRules; + } + } + + /// Flag indicating whether subvolume operations are enabled on the volume. + public EnableSubvolumes? EnableSubvolumes + { + get + { + return Properties is null ? default : Properties.EnableSubvolumes; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.EnableSubvolumes = value.Value; + } + } + + /// The availability zone where the volume is provisioned. This refers to the logical availability zone where the volume resides. + public string ProvisionedAvailabilityZone + { + get + { + return Properties is null ? default : Properties.ProvisionedAvailabilityZone; + } + } + + /// Specifies whether volume is a Large Volume or Regular Volume. + public bool? IsLargeVolume + { + get + { + return Properties is null ? default : Properties.IsLargeVolume; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.IsLargeVolume = value.Value; + } + } + + /// + /// Specifies the type of the Large Volume. When set to 'LargeVolume', the large volume is created with standard configuration. + /// If it is set to 'ExtraLargeVolume7Dot2PiB', the extra large volume is created with higher capacity limit 7.2PiB with cool access enabled, + /// delivering higher capacity limit with lower costs. + /// + public LargeVolumeType? LargeVolumeType + { + get + { + return Properties is null ? default : Properties.LargeVolumeType; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.LargeVolumeType = value.Value; + } + } + + /// Id of the snapshot or backup that the volume is restored from. + public string OriginatingResourceId + { + get + { + return Properties is null ? default : Properties.OriginatingResourceId; + } + } + + /// Space shared by short term clone volume with parent volume in bytes. + public long? InheritedSizeInBytes + { + get + { + return Properties is null ? default : Properties.InheritedSizeInBytes; + } + } + + /// Language supported for volume. + public VolumeLanguage? Language + { + get + { + return Properties is null ? default : Properties.Language; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.Language = value.Value; + } + } + + /// Specifies whether the volume operates in Breakthrough Mode. + public BreakthroughMode? BreakthroughMode + { + get + { + return Properties is null ? default : Properties.BreakthroughMode; + } + set + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + Properties.BreakthroughMode = value.Value; + } + } + + /// Export policy rule. + public IList ExportRules + { + get + { + if (Properties is null) + { + Properties = new VolumeProperties(); + } + return Properties.ExportRules; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsCollection.cs new file mode 100644 index 000000000000..96afedeaa67b --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsCollection.cs @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetVolumeGroupDetails method from an instance of the parent resource. + /// + public partial class VolumeGroupDetailsCollection : ArmCollection + { + private readonly ClientDiagnostics _volumeGroupsClientDiagnostics; + private readonly VolumeGroups _volumeGroupsRestClient; + + /// Initializes a new instance of VolumeGroupDetailsCollection for mocking. + protected VolumeGroupDetailsCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal VolumeGroupDetailsCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(VolumeGroupDetailsResource.ResourceType, out string volumeGroupDetailsApiVersion); + _volumeGroupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", VolumeGroupDetailsResource.ResourceType.Namespace, Diagnostics); + _volumeGroupsRestClient = new VolumeGroups(_volumeGroupsClientDiagnostics, Pipeline, Endpoint, volumeGroupDetailsApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != NetAppAccountResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, NetAppAccountResource.ResourceType), id); + } + } + + /// + /// Create a volume group along with specified volumes + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the volumeGroup. + /// Volume Group object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string volumeGroupName, VolumeGroupDetailsData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, volumeGroupName, VolumeGroupDetailsData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeGroupDetailsOperationSource(Client), + _volumeGroupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a volume group along with specified volumes + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the volumeGroup. + /// Volume Group object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string volumeGroupName, VolumeGroupDetailsData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, volumeGroupName, VolumeGroupDetailsData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeGroupDetailsOperationSource(Client), + _volumeGroupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified volume group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volumeGroup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, volumeGroupName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeGroupDetailsData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeGroupDetailsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified volume group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volumeGroup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, volumeGroupName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeGroupDetailsData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeGroupDetailsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified volume group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volumeGroup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, volumeGroupName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeGroupDetailsData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeGroupDetailsData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified volume group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volumeGroup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, volumeGroupName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeGroupDetailsData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeGroupDetailsData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified volume group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volumeGroup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, volumeGroupName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeGroupDetailsData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeGroupDetailsData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new VolumeGroupDetailsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified volume group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of the volumeGroup. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string volumeGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, volumeGroupName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeGroupDetailsData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeGroupDetailsData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new VolumeGroupDetailsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsData.Serialization.cs new file mode 100644 index 000000000000..22f5a9965090 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsData.Serialization.cs @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Volume group resource for create. + public partial class VolumeGroupDetailsData : ResourceData, IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroupDetailsData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeGroupDetailsData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (VolumeGroupDetailsData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeGroupDetailsData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeGroupDetailsData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeGroupDetailsData DeserializeVolumeGroupDetailsData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + VolumeGroupProperties properties = default; + string location = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = VolumeGroupProperties.DeserializeVolumeGroupProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("location"u8)) + { + location = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeGroupDetailsData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + properties, + location); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeGroupDetailsData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeGroupDetailsData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (VolumeGroupDetailsData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeGroupDetailsData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeGroupDetailsData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(VolumeGroupDetailsData volumeGroupDetailsData) + { + if (volumeGroupDetailsData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(volumeGroupDetailsData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static VolumeGroupDetailsData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeVolumeGroupDetailsData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsData.cs new file mode 100644 index 000000000000..19505839491a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsData.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Volume group resource for create. + public partial class VolumeGroupDetailsData : ResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VolumeGroupDetailsData() + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Volume group properties. + /// Resource location. + internal VolumeGroupDetailsData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, VolumeGroupProperties properties, string location) : base(id, name, resourceType, systemData) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + Location = location; + } + + /// Volume group properties. + internal VolumeGroupProperties Properties { get; set; } + + /// Resource location. + public string Location { get; set; } + + /// Azure lifecycle management. + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Volume group details. + public VolumeGroupMetaData GroupMetaData + { + get + { + return Properties is null ? default : Properties.GroupMetaData; + } + set + { + if (Properties is null) + { + Properties = new VolumeGroupProperties(); + } + Properties.GroupMetaData = value; + } + } + + /// List of volumes from group. + public IList Volumes + { + get + { + if (Properties is null) + { + Properties = new VolumeGroupProperties(); + } + return Properties.Volumes; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsResource.Serialization.cs new file mode 100644 index 000000000000..06efed1f6741 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class VolumeGroupDetailsResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new VolumeGroupDetailsData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + VolumeGroupDetailsData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + VolumeGroupDetailsData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsResource.cs new file mode 100644 index 000000000000..9e53c9625c4a --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupDetailsResource.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a VolumeGroupDetails along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetVolumeGroupDetails method. + /// + public partial class VolumeGroupDetailsResource : ArmResource + { + private readonly ClientDiagnostics _volumeGroupsClientDiagnostics; + private readonly VolumeGroups _volumeGroupsRestClient; + private readonly VolumeGroupDetailsData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/volumeGroups"; + + /// Initializes a new instance of VolumeGroupDetailsResource for mocking. + protected VolumeGroupDetailsResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal VolumeGroupDetailsResource(ArmClient client, VolumeGroupDetailsData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal VolumeGroupDetailsResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string volumeGroupDetailsApiVersion); + _volumeGroupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _volumeGroupsRestClient = new VolumeGroups(_volumeGroupsClientDiagnostics, Pipeline, Endpoint, volumeGroupDetailsApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual VolumeGroupDetailsData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The volumeGroupName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string volumeGroupName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get details of the specified volume group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeGroupDetailsData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeGroupDetailsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified volume group + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeGroupDetailsData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeGroupDetailsResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified volume group only if there are no volumes under volume group. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumeGroupsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified volume group only if there are no volumes under volume group. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumeGroupsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a volume group along with specified volumes + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Volume Group object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, VolumeGroupDetailsData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, VolumeGroupDetailsData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeGroupDetailsOperationSource(Client), + _volumeGroupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a volume group along with specified volumes + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}. + /// + /// + /// Operation Id. + /// VolumeGroups_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Volume Group object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, VolumeGroupDetailsData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _volumeGroupsClientDiagnostics.CreateScope("VolumeGroupDetailsResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeGroupsRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, VolumeGroupDetailsData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeGroupDetailsOperationSource(Client), + _volumeGroupsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupsGetByNetAppAccountAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupsGetByNetAppAccountAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..0ecadf4822bb --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupsGetByNetAppAccountAsyncCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class VolumeGroupsGetByNetAppAccountAsyncCollectionResultOfT : AsyncPageable + { + private readonly VolumeGroups _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of VolumeGroupsGetByNetAppAccountAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The VolumeGroups client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public VolumeGroupsGetByNetAppAccountAsyncCollectionResultOfT(VolumeGroups client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of VolumeGroupsGetByNetAppAccountAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VolumeGroupsGetByNetAppAccountAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + VolumeGroupList result = VolumeGroupList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByNetAppAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByNetAppAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("NetAppAccountResource.GetByNetAppAccount"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupsGetByNetAppAccountCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupsGetByNetAppAccountCollectionResultOfT.cs new file mode 100644 index 000000000000..f73d67b41ccd --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeGroupsGetByNetAppAccountCollectionResultOfT.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class VolumeGroupsGetByNetAppAccountCollectionResultOfT : Pageable + { + private readonly VolumeGroups _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly RequestContext _context; + + /// Initializes a new instance of VolumeGroupsGetByNetAppAccountCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The VolumeGroups client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public VolumeGroupsGetByNetAppAccountCollectionResultOfT(VolumeGroups client, Guid subscriptionId, string resourceGroupName, string accountName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _context = context; + } + + /// Gets the pages of VolumeGroupsGetByNetAppAccountCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VolumeGroupsGetByNetAppAccountCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + VolumeGroupList result = VolumeGroupList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByNetAppAccountRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _context) : _client.CreateGetByNetAppAccountRequest(_subscriptionId, _resourceGroupName, _accountName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("NetAppAccountResource.GetByNetAppAccount"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleCollection.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleCollection.cs new file mode 100644 index 000000000000..8e750493e15e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleCollection.cs @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetVolumeQuotaRules method from an instance of the parent resource. + /// + public partial class VolumeQuotaRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _volumeQuotaRulesClientDiagnostics; + private readonly VolumeQuotaRules _volumeQuotaRulesRestClient; + + /// Initializes a new instance of VolumeQuotaRuleCollection for mocking. + protected VolumeQuotaRuleCollection() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal VolumeQuotaRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(VolumeQuotaRuleResource.ResourceType, out string volumeQuotaRuleApiVersion); + _volumeQuotaRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", VolumeQuotaRuleResource.ResourceType.Namespace, Diagnostics); + _volumeQuotaRulesRestClient = new VolumeQuotaRules(_volumeQuotaRulesClientDiagnostics, Pipeline, Endpoint, volumeQuotaRuleApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != VolumeResource.ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, VolumeResource.ResourceType), id); + } + } + + /// + /// Create the specified quota rule within the given volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of volume quota rule. + /// Quota rule object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string volumeQuotaRuleName, VolumeQuotaRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, VolumeQuotaRuleData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeQuotaRuleOperationSource(Client), + _volumeQuotaRulesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create the specified quota rule within the given volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Create. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of volume quota rule. + /// Quota rule object supplied in the body of the operation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string volumeQuotaRuleName, VolumeQuotaRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + Argument.AssertNotNull(data, nameof(data)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleCollection.CreateOrUpdate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateCreateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, VolumeQuotaRuleData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeQuotaRuleOperationSource(Client), + _volumeQuotaRulesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of volume quota rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string volumeQuotaRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of volume quota rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string volumeQuotaRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleCollection.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all quota rules associated with the volume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new VolumeQuotaRulesGetByVolumeAsyncCollectionResultOfT( + _volumeQuotaRulesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new VolumeQuotaRuleResource(Client, data)); + } + + /// List all quota rules associated with the volume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new VolumeQuotaRulesGetByVolumeCollectionResultOfT( + _volumeQuotaRulesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + context), data => new VolumeQuotaRuleResource(Client, data)); + } + + /// + /// Get details of the specified quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of volume quota rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string volumeQuotaRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeQuotaRuleData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of volume quota rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string volumeQuotaRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleCollection.Exists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeQuotaRuleData)null, result); + break; + default: + throw new RequestFailedException(result); + } + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of volume quota rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string volumeQuotaRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeQuotaRuleData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// + /// The name of volume quota rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string volumeQuotaRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleCollection.GetIfExists"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, volumeQuotaRuleName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((VolumeQuotaRuleData)null, result); + break; + default: + throw new RequestFailedException(result); + } + if (response.Value == null) + { + return new NoValueResponse(response.GetRawResponse()); + } + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + /// The cancellation token to use. + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleData.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleData.Serialization.cs new file mode 100644 index 000000000000..0ea4de73d0f0 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleData.Serialization.cs @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Quota Rule of a Volume. + public partial class VolumeQuotaRuleData : TrackedResourceData, IJsonModel + { + /// Initializes a new instance of for deserialization. + internal VolumeQuotaRuleData() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeQuotaRuleData)} does not support writing '{format}' format."); + } + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + VolumeQuotaRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (VolumeQuotaRuleData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeQuotaRuleData)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeQuotaRuleData(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VolumeQuotaRuleData DeserializeVolumeQuotaRuleData(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType resourceType = default; + SystemData systemData = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + VolumeQuotaRulesProperties properties = default; + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemData"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerNetAppContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("properties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = VolumeQuotaRulesProperties.DeserializeVolumeQuotaRulesProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VolumeQuotaRuleData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerNetAppContext.Default); + default: + throw new FormatException($"The model {nameof(VolumeQuotaRuleData)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VolumeQuotaRuleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (VolumeQuotaRuleData)PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeVolumeQuotaRuleData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeQuotaRuleData)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(VolumeQuotaRuleData volumeQuotaRuleData) + { + if (volumeQuotaRuleData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(volumeQuotaRuleData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static VolumeQuotaRuleData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeVolumeQuotaRuleData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleData.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleData.cs new file mode 100644 index 000000000000..7834feebdee4 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleData.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + /// Quota Rule of a Volume. + public partial class VolumeQuotaRuleData : TrackedResourceData + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public VolumeQuotaRuleData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// Volume Quota Rule Properties. + internal VolumeQuotaRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, VolumeQuotaRulesProperties properties) : base(id, name, resourceType, systemData, tags, location) + { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; + } + + /// Volume Quota Rule Properties. + internal VolumeQuotaRulesProperties Properties { get; set; } + + /// Gets the status of the VolumeQuotaRule at the time the operation was called. + public Models.NetAppProvisioningState? ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + + /// Size of quota. + public long? QuotaSizeInKiBs + { + get + { + return Properties is null ? default : Properties.QuotaSizeInKiBs; + } + set + { + if (Properties is null) + { + Properties = new VolumeQuotaRulesProperties(); + } + Properties.QuotaSizeInKiBs = value.Value; + } + } + + /// Type of quota. + public Models.Type? QuotaType + { + get + { + return Properties is null ? default : Properties.QuotaType; + } + set + { + if (Properties is null) + { + Properties = new VolumeQuotaRulesProperties(); + } + Properties.QuotaType = value.Value; + } + } + + /// UserID/GroupID/SID based on the quota target type. UserID and groupID can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by running <wmic useraccount where name='user-name' get sid>. + public string QuotaTarget + { + get + { + return Properties is null ? default : Properties.QuotaTarget; + } + set + { + if (Properties is null) + { + Properties = new VolumeQuotaRulesProperties(); + } + Properties.QuotaTarget = value; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleResource.Serialization.cs new file mode 100644 index 000000000000..a1a48a42715d --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class VolumeQuotaRuleResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new VolumeQuotaRuleData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + VolumeQuotaRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + VolumeQuotaRuleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleResource.cs new file mode 100644 index 000000000000..c369a89fbfa9 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRuleResource.cs @@ -0,0 +1,685 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a VolumeQuotaRule along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetVolumeQuotaRules method. + /// + public partial class VolumeQuotaRuleResource : ArmResource + { + private readonly ClientDiagnostics _volumeQuotaRulesClientDiagnostics; + private readonly VolumeQuotaRules _volumeQuotaRulesRestClient; + private readonly VolumeQuotaRuleData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/volumeQuotaRules"; + + /// Initializes a new instance of VolumeQuotaRuleResource for mocking. + protected VolumeQuotaRuleResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal VolumeQuotaRuleResource(ArmClient client, VolumeQuotaRuleData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal VolumeQuotaRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string volumeQuotaRuleApiVersion); + _volumeQuotaRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _volumeQuotaRulesRestClient = new VolumeQuotaRules(_volumeQuotaRulesClientDiagnostics, Pipeline, Endpoint, volumeQuotaRuleApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual VolumeQuotaRuleData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + /// The volumeQuotaRuleName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, string volumeQuotaRuleName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get details of the specified quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get details of the specified quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch a quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Quota rule object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, VolumeQuotaRulePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, VolumeQuotaRulePatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeQuotaRuleOperationSource(Client), + _volumeQuotaRulesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch a quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Quota rule object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, VolumeQuotaRulePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, VolumeQuotaRulePatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeQuotaRuleOperationSource(Client), + _volumeQuotaRulesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumeQuotaRulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete quota rule + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}. + /// + /// + /// Operation Id. + /// VolumeQuotaRules_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumeQuotaRulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeQuotaRuleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + VolumeQuotaRulePatch patch = new VolumeQuotaRulePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeQuotaRuleData current = Get(cancellationToken: cancellationToken).Value.Data; + VolumeQuotaRulePatch patch = new VolumeQuotaRulePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeQuotaRuleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + VolumeQuotaRulePatch patch = new VolumeQuotaRulePatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeQuotaRuleData current = Get(cancellationToken: cancellationToken).Value.Data; + VolumeQuotaRulePatch patch = new VolumeQuotaRulePatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeQuotaRuleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + VolumeQuotaRulePatch patch = new VolumeQuotaRulePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _volumeQuotaRulesClientDiagnostics.CreateScope("VolumeQuotaRuleResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumeQuotaRulesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeQuotaRuleData.FromResponse(result), result); + return Response.FromValue(new VolumeQuotaRuleResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeQuotaRuleData current = Get(cancellationToken: cancellationToken).Value.Data; + VolumeQuotaRulePatch patch = new VolumeQuotaRulePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRulesGetByVolumeAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRulesGetByVolumeAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..8507257ecd0e --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRulesGetByVolumeAsyncCollectionResultOfT.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class VolumeQuotaRulesGetByVolumeAsyncCollectionResultOfT : AsyncPageable + { + private readonly VolumeQuotaRules _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of VolumeQuotaRulesGetByVolumeAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The VolumeQuotaRules client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public VolumeQuotaRulesGetByVolumeAsyncCollectionResultOfT(VolumeQuotaRules client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of VolumeQuotaRulesGetByVolumeAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VolumeQuotaRulesGetByVolumeAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + VolumeQuotaRulesList result = VolumeQuotaRulesList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByVolumeRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetByVolumeRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("VolumeQuotaRuleCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRulesGetByVolumeCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRulesGetByVolumeCollectionResultOfT.cs new file mode 100644 index 000000000000..2cef12d7fa96 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeQuotaRulesGetByVolumeCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class VolumeQuotaRulesGetByVolumeCollectionResultOfT : Pageable + { + private readonly VolumeQuotaRules _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContext _context; + + /// Initializes a new instance of VolumeQuotaRulesGetByVolumeCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The VolumeQuotaRules client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public VolumeQuotaRulesGetByVolumeCollectionResultOfT(VolumeQuotaRules client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _context = context; + } + + /// Gets the pages of VolumeQuotaRulesGetByVolumeCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VolumeQuotaRulesGetByVolumeCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + VolumeQuotaRulesList result = VolumeQuotaRulesList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByVolumeRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context) : _client.CreateGetByVolumeRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("VolumeQuotaRuleCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeResource.Serialization.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeResource.Serialization.cs new file mode 100644 index 000000000000..a3f330a9c047 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeResource.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NetApp +{ + /// + public partial class VolumeResource : IJsonModel + { + private static IJsonModel s_dataDeserializationInstance; + + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new VolumeData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + /// The reader for deserializing the model. + /// The client options for reading and writing models. + VolumeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerNetAppContext.Default); + + /// The binary data to be processed. + /// The client options for reading and writing models. + VolumeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerNetAppContext.Default); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeResource.cs new file mode 100644 index 000000000000..e1aa512b860c --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumeResource.cs @@ -0,0 +1,3487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.NetApp.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NetApp +{ + /// + /// A class representing a Volume along with the instance operations that can be performed on it. + /// If you have a you can construct a from an instance of using the GetResource method. + /// Otherwise you can get one from its parent resource using the GetVolumes method. + /// + public partial class VolumeResource : ArmResource + { + private readonly ClientDiagnostics _backupsClientDiagnostics; + private readonly Backups _backupsRestClient; + private readonly ClientDiagnostics _volumesClientDiagnostics; + private readonly Volumes _volumesRestClient; + private readonly ClientDiagnostics _backupsUnderVolumeClientDiagnostics; + private readonly BackupsUnderVolume _backupsUnderVolumeRestClient; + private readonly VolumeData _data; + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/latestBackupStatus"; + + /// Initializes a new instance of VolumeResource for mocking. + protected VolumeResource() + { + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal VolumeResource(ArmClient client, VolumeData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal VolumeResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + TryGetApiVersion(ResourceType, out string volumeApiVersion); + _backupsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _backupsRestClient = new Backups(_backupsClientDiagnostics, Pipeline, Endpoint, volumeApiVersion ?? "2025-09-01-preview"); + _volumesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _volumesRestClient = new Volumes(_volumesClientDiagnostics, Pipeline, Endpoint, volumeApiVersion ?? "2025-09-01-preview"); + _backupsUnderVolumeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NetApp", ResourceType.Namespace, Diagnostics); + _backupsUnderVolumeRestClient = new BackupsUnderVolume(_backupsUnderVolumeClientDiagnostics, Pipeline, Endpoint, volumeApiVersion ?? "2025-09-01-preview"); + ValidateResourceId(id); + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + public virtual VolumeData Data + { + get + { + if (!HasData) + { + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } + return _data; + } + } + + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The poolName. + /// The volumeName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } + } + + /// + /// Get the latest status of the backup for a volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/latestBackupStatus/current. + /// + /// + /// Operation Id. + /// Volumes_GetLatestStatus. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetLatestStatusAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("VolumeResource.GetLatestStatus"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetLatestStatusRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetAppVolumeBackupStatus.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the latest status of the backup for a volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/latestBackupStatus/current. + /// + /// + /// Operation Id. + /// Volumes_GetLatestStatus. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetLatestStatus(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("VolumeResource.GetLatestStatus"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetLatestStatusRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetAppVolumeBackupStatus.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the latest status of the restore for a volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/latestRestoreStatus/current. + /// + /// + /// Operation Id. + /// Volumes_GetVolumeLatestRestoreStatus. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetVolumeLatestRestoreStatusAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("VolumeResource.GetVolumeLatestRestoreStatus"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetVolumeLatestRestoreStatusRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(NetAppRestoreStatus.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the latest status of the restore for a volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/latestRestoreStatus/current. + /// + /// + /// Operation Id. + /// Volumes_GetVolumeLatestRestoreStatus. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetVolumeLatestRestoreStatus(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _backupsClientDiagnostics.CreateScope("VolumeResource.GetVolumeLatestRestoreStatus"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsRestClient.CreateGetVolumeLatestRestoreStatusRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(NetAppRestoreStatus.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the details of the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Get. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Volume object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, VolumePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, VolumePatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeOperationSource(Client), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Update. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Volume object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, VolumePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, VolumePatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeOperationSource(Client), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// An option to force delete the volume. Will cleanup resources connected to the particular volume. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? forceDelete = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, forceDelete, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the specified volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}. + /// + /// + /// Operation Id. + /// Volumes_Delete. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// An option to force delete the volume. Will cleanup resources connected to the particular volume. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, bool? forceDelete = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, forceDelete, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This operation will populate availability zone information for a volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/populateAvailabilityZone. + /// + /// + /// Operation Id. + /// Volumes_PopulateAvailabilityZone. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> PopulateAvailabilityZoneAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.PopulateAvailabilityZone"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreatePopulateAvailabilityZoneRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeOperationSource(Client), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// This operation will populate availability zone information for a volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/populateAvailabilityZone. + /// + /// + /// Operation Id. + /// Volumes_PopulateAvailabilityZone. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation PopulateAvailabilityZone(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.PopulateAvailabilityZone"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreatePopulateAvailabilityZoneRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeOperationSource(Client), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Revert a volume to the snapshot specified in the body + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert. + /// + /// + /// Operation Id. + /// Volumes_Revert. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Object for snapshot to revert supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task RevertAsync(WaitUntil waitUntil, VolumeRevert body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.Revert"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateRevertRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, VolumeRevert.ToRequestContent(body), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Revert a volume to the snapshot specified in the body + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert. + /// + /// + /// Operation Id. + /// Volumes_Revert. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Object for snapshot to revert supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Revert(WaitUntil waitUntil, VolumeRevert body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.Revert"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateRevertRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, VolumeRevert.ToRequestContent(body), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Reset cifs password from volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword. + /// + /// + /// Operation Id. + /// Volumes_ResetCifsPassword. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task ResetCifsPasswordAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.ResetCifsPassword"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateResetCifsPasswordRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Reset cifs password from volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword. + /// + /// + /// Operation Id. + /// Volumes_ResetCifsPassword. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation ResetCifsPassword(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.ResetCifsPassword"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateResetCifsPasswordRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Split operation to convert clone volume to an independent volume. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/splitCloneFromParent. + /// + /// + /// Operation Id. + /// Volumes_SplitCloneFromParent. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> SplitCloneFromParentAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.SplitCloneFromParent"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateSplitCloneFromParentRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeOperationSource(Client), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Split operation to convert clone volume to an independent volume. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/splitCloneFromParent. + /// + /// + /// Operation Id. + /// Volumes_SplitCloneFromParent. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation SplitCloneFromParent(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.SplitCloneFromParent"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateSplitCloneFromParentRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new VolumeOperationSource(Client), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Break all the file locks on a volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakFileLocks. + /// + /// + /// Operation Id. + /// Volumes_BreakFileLocks. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Optional body to provide the ability to clear file locks with selected options. + /// The cancellation token to use. + public virtual async Task BreakFileLocksAsync(WaitUntil waitUntil, BreakFileLocksRequest body = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.BreakFileLocks"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateBreakFileLocksRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BreakFileLocksRequest.ToRequestContent(body), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Break all the file locks on a volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakFileLocks. + /// + /// + /// Operation Id. + /// Volumes_BreakFileLocks. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Optional body to provide the ability to clear file locks with selected options. + /// The cancellation token to use. + public virtual ArmOperation BreakFileLocks(WaitUntil waitUntil, BreakFileLocksRequest body = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.BreakFileLocks"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateBreakFileLocksRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BreakFileLocksRequest.ToRequestContent(body), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the list of group Ids for a specific LDAP User + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/getGroupIdListForLdapUser. + /// + /// + /// Operation Id. + /// Volumes_ListGetGroupIdListForLdapUser. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Returns group Id list for a specific LDAP user. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetGetGroupIdListForLdapUserAsync(WaitUntil waitUntil, GetGroupIdListForLdapUserRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.GetGetGroupIdListForLdapUser"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetGetGroupIdListForLdapUserRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, GetGroupIdListForLdapUserRequest.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new GetGroupIdListForLdapUserResponseOperationSource(), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the list of group Ids for a specific LDAP User + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/getGroupIdListForLdapUser. + /// + /// + /// Operation Id. + /// Volumes_ListGetGroupIdListForLdapUser. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Returns group Id list for a specific LDAP user. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation GetGetGroupIdListForLdapUser(WaitUntil waitUntil, GetGroupIdListForLdapUserRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.GetGetGroupIdListForLdapUser"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetGetGroupIdListForLdapUserRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, GetGroupIdListForLdapUserRequest.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new GetGroupIdListForLdapUserResponseOperationSource(), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Break the replication connection on the destination volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication. + /// + /// + /// Operation Id. + /// Volumes_BreakReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Optional body to force break the replication. + /// The cancellation token to use. + public virtual async Task BreakReplicationAsync(WaitUntil waitUntil, BreakReplicationRequest body = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.BreakReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateBreakReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BreakReplicationRequest.ToRequestContent(body), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Break the replication connection on the destination volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication. + /// + /// + /// Operation Id. + /// Volumes_BreakReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Optional body to force break the replication. + /// The cancellation token to use. + public virtual ArmOperation BreakReplication(WaitUntil waitUntil, BreakReplicationRequest body = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.BreakReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateBreakReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BreakReplicationRequest.ToRequestContent(body), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Re-establish a previously deleted replication between 2 volumes that have a common ad-hoc or policy-based snapshots + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication. + /// + /// + /// Operation Id. + /// Volumes_ReestablishReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// body for the id of the source volume. + /// The cancellation token to use. + /// is null. + public virtual async Task ReestablishReplicationAsync(WaitUntil waitUntil, ReestablishReplicationRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.ReestablishReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateReestablishReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ReestablishReplicationRequest.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Re-establish a previously deleted replication between 2 volumes that have a common ad-hoc or policy-based snapshots + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reestablishReplication. + /// + /// + /// Operation Id. + /// Volumes_ReestablishReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// body for the id of the source volume. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation ReestablishReplication(WaitUntil waitUntil, ReestablishReplicationRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.ReestablishReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateReestablishReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, ReestablishReplicationRequest.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the status of the replication + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus. + /// + /// + /// Operation Id. + /// Volumes_ReplicationStatus. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> ReplicationStatusAsync(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.ReplicationStatus"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateReplicationStatusRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(Models.ReplicationStatus.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the status of the replication + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus. + /// + /// + /// Operation Id. + /// Volumes_ReplicationStatus. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + public virtual Response ReplicationStatus(CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.ReplicationStatus"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateReplicationStatusRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(Models.ReplicationStatus.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List all replications for a specified volume. + /// The content of the action request. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetReplicationsAsync(ListReplicationsRequest body = default, CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new VolumesGetReplicationsAsyncCollectionResultOfT( + _volumesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + ListReplicationsRequest.ToRequestContent(body), + context); + } + + /// List all replications for a specified volume. + /// The content of the action request. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetReplications(ListReplicationsRequest body = default, CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new VolumesGetReplicationsCollectionResultOfT( + _volumesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + ListReplicationsRequest.ToRequestContent(body), + context); + } + + /// + /// Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from destination to source. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication. + /// + /// + /// Operation Id. + /// Volumes_ResyncReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task ResyncReplicationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.ResyncReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateResyncReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Resync the connection on the destination volume. If the operation is ran on the source volume it will reverse-resync the connection and sync from destination to source. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication. + /// + /// + /// Operation Id. + /// Volumes_ResyncReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation ResyncReplication(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.ResyncReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateResyncReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the replication connection on the destination volume, and send release to the source replication + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication. + /// + /// + /// Operation Id. + /// Volumes_DeleteReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteReplicationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.DeleteReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateDeleteReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete the replication connection on the destination volume, and send release to the source replication + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication. + /// + /// + /// Operation Id. + /// Volumes_DeleteReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation DeleteReplication(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.DeleteReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateDeleteReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Authorize the replication connection on the source volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication. + /// + /// + /// Operation Id. + /// Volumes_AuthorizeReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Authorize request object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task AuthorizeReplicationAsync(WaitUntil waitUntil, AuthorizeRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.AuthorizeReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateAuthorizeReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, AuthorizeRequest.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Authorize the replication connection on the source volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication. + /// + /// + /// Operation Id. + /// Volumes_AuthorizeReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Authorize request object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation AuthorizeReplication(WaitUntil waitUntil, AuthorizeRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.AuthorizeReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateAuthorizeReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, AuthorizeRequest.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Re-Initializes the replication connection on the destination volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication. + /// + /// + /// Operation Id. + /// Volumes_ReInitializeReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task ReInitializeReplicationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.ReInitializeReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateReInitializeReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Re-Initializes the replication connection on the destination volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication. + /// + /// + /// Operation Id. + /// Volumes_ReInitializeReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation ReInitializeReplication(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.ReInitializeReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateReInitializeReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Starts peering the external cluster for this migration volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/peerExternalCluster. + /// + /// + /// Operation Id. + /// Volumes_PeerExternalCluster. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Cluster peer request object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> PeerExternalClusterAsync(WaitUntil waitUntil, PeerClusterForVolumeMigrationRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.PeerExternalCluster"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreatePeerExternalClusterRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, PeerClusterForVolumeMigrationRequest.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ClusterPeerCommandResponseOperationSource(), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Starts peering the external cluster for this migration volume + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/peerExternalCluster. + /// + /// + /// Operation Id. + /// Volumes_PeerExternalCluster. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Cluster peer request object supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation PeerExternalCluster(WaitUntil waitUntil, PeerClusterForVolumeMigrationRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.PeerExternalCluster"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreatePeerExternalClusterRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, PeerClusterForVolumeMigrationRequest.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ClusterPeerCommandResponseOperationSource(), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Starts SVM peering and returns a command to be run on the external ONTAP to accept it. Once the SVM have been peered a SnapMirror will be created + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeExternalReplication. + /// + /// + /// Operation Id. + /// Volumes_AuthorizeExternalReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> AuthorizeExternalReplicationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.AuthorizeExternalReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateAuthorizeExternalReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new SvmPeerCommandResponseOperationSource(), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Starts SVM peering and returns a command to be run on the external ONTAP to accept it. Once the SVM have been peered a SnapMirror will be created + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeExternalReplication. + /// + /// + /// Operation Id. + /// Volumes_AuthorizeExternalReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation AuthorizeExternalReplication(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.AuthorizeExternalReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateAuthorizeExternalReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new SvmPeerCommandResponseOperationSource(), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Finalizes the migration of an external volume by releasing the replication and breaking the external cluster peering if no other migration is active. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeExternalReplication. + /// + /// + /// Operation Id. + /// Volumes_FinalizeExternalReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task FinalizeExternalReplicationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.FinalizeExternalReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateFinalizeExternalReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Finalizes the migration of an external volume by releasing the replication and breaking the external cluster peering if no other migration is active. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeExternalReplication. + /// + /// + /// Operation Id. + /// Volumes_FinalizeExternalReplication. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation FinalizeExternalReplication(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.FinalizeExternalReplication"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateFinalizeExternalReplicationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Performs an adhoc replication transfer on a volume with volumeType Migration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/performReplicationTransfer. + /// + /// + /// Operation Id. + /// Volumes_PerformReplicationTransfer. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task PerformReplicationTransferAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.PerformReplicationTransfer"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreatePerformReplicationTransferRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Performs an adhoc replication transfer on a volume with volumeType Migration + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/performReplicationTransfer. + /// + /// + /// Operation Id. + /// Volumes_PerformReplicationTransfer. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation PerformReplicationTransfer(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.PerformReplicationTransfer"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreatePerformReplicationTransferRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Moves volume to another pool + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange. + /// + /// + /// Operation Id. + /// Volumes_PoolChange. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Move volume to the pool supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task PoolChangeAsync(WaitUntil waitUntil, PoolChangeRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.PoolChange"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreatePoolChangeRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, PoolChangeRequest.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Moves volume to another pool + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange. + /// + /// + /// Operation Id. + /// Volumes_PoolChange. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Move volume to the pool supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation PoolChange(WaitUntil waitUntil, PoolChangeRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.PoolChange"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreatePoolChangeRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, PoolChangeRequest.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Relocates volume to a new stamp + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate. + /// + /// + /// Operation Id. + /// Volumes_Relocate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Relocate volume request. + /// The cancellation token to use. + public virtual async Task RelocateAsync(WaitUntil waitUntil, RelocateVolumeRequest body = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.Relocate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateRelocateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, RelocateVolumeRequest.ToRequestContent(body), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Relocates volume to a new stamp + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate. + /// + /// + /// Operation Id. + /// Volumes_Relocate. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Relocate volume request. + /// The cancellation token to use. + public virtual ArmOperation Relocate(WaitUntil waitUntil, RelocateVolumeRequest body = default, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.Relocate"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateRelocateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, RelocateVolumeRequest.ToRequestContent(body), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Finalizes the relocation of the volume and cleans up the old volume. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation. + /// + /// + /// Operation Id. + /// Volumes_FinalizeRelocation. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task FinalizeRelocationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.FinalizeRelocation"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateFinalizeRelocationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Finalizes the relocation of the volume and cleans up the old volume. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation. + /// + /// + /// Operation Id. + /// Volumes_FinalizeRelocation. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation FinalizeRelocation(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.FinalizeRelocation"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateFinalizeRelocationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Reverts the volume relocation process, cleans up the new volume and starts using the former-existing volume. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation. + /// + /// + /// Operation Id. + /// Volumes_RevertRelocation. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task RevertRelocationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.RevertRelocation"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateRevertRelocationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Reverts the volume relocation process, cleans up the new volume and starts using the former-existing volume. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation. + /// + /// + /// Operation Id. + /// Volumes_RevertRelocation. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation RevertRelocation(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.RevertRelocation"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateRevertRelocationRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_volumesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// A long-running resource action. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listQuotaReport. + /// + /// + /// Operation Id. + /// Volumes_ListQuotaReport. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> GetQuotaReportAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.GetQuotaReport"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetQuotaReportRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation( + new ListQuotaReportResponseOperationSource(), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// A long-running resource action. + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listQuotaReport. + /// + /// + /// Operation Id. + /// Volumes_ListQuotaReport. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation GetQuotaReport(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.GetQuotaReport"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetQuotaReportRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation( + new ListQuotaReportResponseOperationSource(), + _volumesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletion(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Migrate the backups under volume to backup vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/migrateBackups. + /// + /// + /// Operation Id. + /// Volumes_MigrateBackups. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Migrate backups under volume payload supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task MigrateBackupsAsync(WaitUntil waitUntil, BackupsMigrationRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _backupsUnderVolumeClientDiagnostics.CreateScope("VolumeResource.MigrateBackups"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsUnderVolumeRestClient.CreateMigrateBackupsRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BackupsMigrationRequest.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + NetAppArmOperation operation = new NetAppArmOperation(_backupsUnderVolumeClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Migrate the backups under volume to backup vault + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/migrateBackups. + /// + /// + /// Operation Id. + /// Volumes_MigrateBackups. + /// + /// + /// Default Api Version. + /// 2025-09-01-preview. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Migrate backups under volume payload supplied in the body of the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation MigrateBackups(WaitUntil waitUntil, BackupsMigrationRequest content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _backupsUnderVolumeClientDiagnostics.CreateScope("VolumeResource.MigrateBackups"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _backupsUnderVolumeRestClient.CreateMigrateBackupsRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, BackupsMigrationRequest.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + NetAppArmOperation operation = new NetAppArmOperation(_backupsUnderVolumeClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeData.FromResponse(result), result); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + VolumePatch patch = new VolumePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeData.FromResponse(result), result); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeData current = Get(cancellationToken: cancellationToken).Value.Data; + VolumePatch patch = new VolumePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeData.FromResponse(result), result); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + VolumePatch patch = new VolumePatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeData.FromResponse(result), result); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeData current = Get(cancellationToken: cancellationToken).Value.Data; + VolumePatch patch = new VolumePatch(); + patch.Tags.ReplaceWith(tags); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) + { + Response originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(VolumeData.FromResponse(result), result); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + VolumePatch patch = new VolumePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _volumesClientDiagnostics.CreateScope("VolumeResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _volumesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(VolumeData.FromResponse(result), result); + return Response.FromValue(new VolumeResource(Client, response.Value), response.GetRawResponse()); + } + else + { + VolumeData current = Get(cancellationToken: cancellationToken).Value.Data; + VolumePatch patch = new VolumePatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a collection of Snapshots in the . + /// An object representing collection of Snapshots and their operations over a SnapshotResource. + public virtual SnapshotCollection GetSnapshots() + { + return GetCachedClient(client => new SnapshotCollection(client, Id)); + } + + /// Get details of the specified snapshot. + /// The name of the snapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSnapshotAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + return await GetSnapshots().GetAsync(snapshotName, cancellationToken).ConfigureAwait(false); + } + + /// Get details of the specified snapshot. + /// The name of the snapshot. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSnapshot(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + return GetSnapshots().Get(snapshotName, cancellationToken); + } + + /// Gets a collection of VolumeQuotaRules in the . + /// An object representing collection of VolumeQuotaRules and their operations over a VolumeQuotaRuleResource. + public virtual VolumeQuotaRuleCollection GetVolumeQuotaRules() + { + return GetCachedClient(client => new VolumeQuotaRuleCollection(client, Id)); + } + + /// Get details of the specified quota rule. + /// The name of volume quota rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetVolumeQuotaRuleAsync(string volumeQuotaRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + + return await GetVolumeQuotaRules().GetAsync(volumeQuotaRuleName, cancellationToken).ConfigureAwait(false); + } + + /// Get details of the specified quota rule. + /// The name of volume quota rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetVolumeQuotaRule(string volumeQuotaRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(volumeQuotaRuleName, nameof(volumeQuotaRuleName)); + + return GetVolumeQuotaRules().Get(volumeQuotaRuleName, cancellationToken); + } + + /// Gets a collection of RansomwareReports in the . + /// An object representing collection of RansomwareReports and their operations over a RansomwareReportResource. + public virtual RansomwareReportCollection GetRansomwareReports() + { + return GetCachedClient(client => new RansomwareReportCollection(client, Id)); + } + + /// + /// Get details of the specified ransomware report (ARP) + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// The name of the ransomware report. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRansomwareReportAsync(string ransomwareReportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ransomwareReportName, nameof(ransomwareReportName)); + + return await GetRansomwareReports().GetAsync(ransomwareReportName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get details of the specified ransomware report (ARP) + /// ARP reports are created with a list of suspected files when it detects any combination of high data entropy, abnormal volume activity with data encryption, and unusual file extensions. + /// ARP creates snapshots named Anti_ransomware_backup when it detects a potential ransomware threat. You can use one of these ARP snapshots or another snapshot of your volume to restore data. + /// + /// The name of the ransomware report. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRansomwareReport(string ransomwareReportName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(ransomwareReportName, nameof(ransomwareReportName)); + + return GetRansomwareReports().Get(ransomwareReportName, cancellationToken); + } + + /// Gets a collection of Buckets in the . + /// An object representing collection of Buckets and their operations over a BucketResource. + public virtual BucketCollection GetBuckets() + { + return GetCachedClient(client => new BucketCollection(client, Id)); + } + + /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// The name of the bucket. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBucketAsync(string bucketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); + + return await GetBuckets().GetAsync(bucketName, cancellationToken).ConfigureAwait(false); + } + + /// Get the details of the specified volume's bucket. A bucket allows additional services, such as AI services, connect to the volume data contained in those buckets. + /// The name of the bucket. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBucket(string bucketName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(bucketName, nameof(bucketName)); + + return GetBuckets().Get(bucketName, cancellationToken); + } + + /// Gets a collection of SubvolumeInfos in the . + /// An object representing collection of SubvolumeInfos and their operations over a SubvolumeInfoResource. + public virtual SubvolumeInfoCollection GetSubvolumeInfos() + { + return GetCachedClient(client => new SubvolumeInfoCollection(client, Id)); + } + + /// Returns the path associated with the subvolumeName provided. + /// The name of the subvolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSubvolumeInfoAsync(string subvolumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + + return await GetSubvolumeInfos().GetAsync(subvolumeName, cancellationToken).ConfigureAwait(false); + } + + /// Returns the path associated with the subvolumeName provided. + /// The name of the subvolume. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSubvolumeInfo(string subvolumeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subvolumeName, nameof(subvolumeName)); + + return GetSubvolumeInfos().Get(subvolumeName, cancellationToken); + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetAllAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..be57ea549fb6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class VolumesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Volumes _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly RequestContext _context; + + /// Initializes a new instance of VolumesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Volumes client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public VolumesGetAllAsyncCollectionResultOfT(Volumes client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _context = context; + } + + /// Gets the pages of VolumesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VolumesGetAllAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + VolumeList result = VolumeList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("VolumeCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetAllCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..e708e420cc52 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetAllCollectionResultOfT.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class VolumesGetAllCollectionResultOfT : Pageable + { + private readonly Volumes _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly RequestContext _context; + + /// Initializes a new instance of VolumesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Volumes client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public VolumesGetAllCollectionResultOfT(Volumes client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _context = context; + } + + /// Gets the pages of VolumesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VolumesGetAllCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + VolumeList result = VolumeList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("VolumeCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetReplicationsAsyncCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetReplicationsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..05110dcbf512 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetReplicationsAsyncCollectionResultOfT.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class VolumesGetReplicationsAsyncCollectionResultOfT : AsyncPageable + { + private readonly Volumes _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContent _content; + private readonly RequestContext _context; + + /// Initializes a new instance of VolumesGetReplicationsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Volumes client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public VolumesGetReplicationsAsyncCollectionResultOfT(Volumes client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + Argument.AssertNotNull(content, nameof(content)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _content = content; + _context = context; + } + + /// Gets the pages of VolumesGetReplicationsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VolumesGetReplicationsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ListReplications result = ListReplications.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetReplicationsRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _content, _context) : _client.CreateGetReplicationsRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _content, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("VolumeResource.GetReplications"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetReplicationsCollectionResultOfT.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetReplicationsCollectionResultOfT.cs new file mode 100644 index 000000000000..3fe86fa5c9b6 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/VolumesGetReplicationsCollectionResultOfT.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NetApp.Models; + +namespace Azure.ResourceManager.NetApp +{ + internal partial class VolumesGetReplicationsCollectionResultOfT : Pageable + { + private readonly Volumes _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _accountName; + private readonly string _poolName; + private readonly string _volumeName; + private readonly RequestContent _content; + private readonly RequestContext _context; + + /// Initializes a new instance of VolumesGetReplicationsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Volumes client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the NetApp account. + /// The name of the capacity pool. + /// The name of the volume. + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public VolumesGetReplicationsCollectionResultOfT(Volumes client, Guid subscriptionId, string resourceGroupName, string accountName, string poolName, string volumeName, RequestContent content, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); + Argument.AssertNotNull(content, nameof(content)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _accountName = accountName; + _poolName = poolName; + _volumeName = volumeName; + _content = content; + _context = context; + } + + /// Gets the pages of VolumesGetReplicationsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VolumesGetReplicationsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ListReplications result = ListReplications.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetReplicationsRequest(nextLink, _subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _content, _context) : _client.CreateGetReplicationsRequest(_subscriptionId, _resourceGroupName, _accountName, _poolName, _volumeName, _content, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("VolumeResource.GetReplications"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/autorest.md b/sdk/netapp/Azure.ResourceManager.NetApp/src/autorest.md.bak similarity index 96% rename from sdk/netapp/Azure.ResourceManager.NetApp/src/autorest.md rename to sdk/netapp/Azure.ResourceManager.NetApp/src/autorest.md.bak index f9ba0bd90473..f1db00f28f5d 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/autorest.md +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/autorest.md.bak @@ -56,10 +56,7 @@ acronym-mapping: TLS: Tls ZRS: Zrs - request-path-to-resource-name: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}: NetAppAccountBackup - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}: NetAppVolumeBackup /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}: NetAppBackupVaultBackup override-operation-name: diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/tsp-location.yaml b/sdk/netapp/Azure.ResourceManager.NetApp/tsp-location.yaml new file mode 100644 index 000000000000..e7cf0e0291e3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/netapp/resource-manager/Microsoft.NetApp/NetApp +commit: 683237470309469ccc6ef40da3bc7998377be4c6 +repo: Azure/azure-rest-api-specs +emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json" diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/tsp_client_metadata.yaml b/sdk/netapp/Azure.ResourceManager.NetApp/tsp_client_metadata.yaml new file mode 100644 index 000000000000..4963eb7630b3 --- /dev/null +++ b/sdk/netapp/Azure.ResourceManager.NetApp/tsp_client_metadata.yaml @@ -0,0 +1,24 @@ +version: 0.29.1 +dateCreatedOrModified: 2025-11-05T08:15:01.169Z +emitterPackageJsonPath: eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json +emitterPackageJsonContent: |- + { + "main": "dist/src/index.js", + "dependencies": { + "@azure-typespec/http-client-csharp-mgmt": "1.0.0-alpha.20251031.1" + }, + "devDependencies": { + "@azure-tools/typespec-autorest": "0.61.0", + "@azure-tools/typespec-azure-core": "0.61.0", + "@azure-tools/typespec-azure-resource-manager": "0.61.0", + "@azure-tools/typespec-azure-rulesets": "0.61.0", + "@azure-tools/typespec-client-generator-core": "0.61.2", + "@azure-tools/typespec-liftr-base": "0.11.0", + "@typespec/compiler": "1.5.0", + "@typespec/http": "1.5.0", + "@typespec/http-client-csharp": "1.0.0-alpha.20251022.4", + "@typespec/openapi": "1.5.0", + "@typespec/rest": "0.75.0", + "@typespec/versioning": "0.75.0" + } + }